(New page: <pre> F0 =13; T0 =1/F0; Ts = 0.07; t = 0:Ts:13*T0; x = real(exp(j*(2*pi*F0*t-pi/2))); plot(t,x) </pre> The graph produced by this code is a wave that appears "blocky". There reason f...) |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | [[Homework 2_ECE301Fall2008mboutin]] - [[HW2-A Phil Cannon_ECE301Fall2008mboutin|'''A''']] - [[HW2-B Phil Cannon_ECE301Fall2008mboutin|'''B''']] - [[HW2-C Phil Cannon_ECE301Fall2008mboutin|'''C''']] - [[HW2-D Phil Cannon_ECE301Fall2008mboutin|'''D''']] - [[HW2-E Phil Cannon_ECE301Fall2008mboutin|'''E''']] | ||
+ | |||
+ | == Bugged Code == | ||
+ | |||
<pre> | <pre> | ||
F0 =13; | F0 =13; | ||
Line 8: | Line 12: | ||
</pre> | </pre> | ||
− | The graph produced by this code is a wave that appears "blocky". There reason for this is because the sampling | + | |
+ | == The Fix == | ||
+ | |||
+ | The graph produced by this code is a sinusoidal wave that appears "blocky". There reason for this is because the sampling rate is too large. The period of the wave is coded as 1/F0, which equals .0769. However, the value for Ts is .07, almost the size of one cycle. This problem can be fixed by reducing the value of Ts. Below is an example of this fix: | ||
<pre> | <pre> |
Latest revision as of 16:05, 11 September 2008
Homework 2_ECE301Fall2008mboutin - A - B - C - D - E
Bugged Code
F0 =13; T0 =1/F0; Ts = 0.07; t = 0:Ts:13*T0; x = real(exp(j*(2*pi*F0*t-pi/2))); plot(t,x)
The Fix
The graph produced by this code is a sinusoidal wave that appears "blocky". There reason for this is because the sampling rate is too large. The period of the wave is coded as 1/F0, which equals .0769. However, the value for Ts is .07, almost the size of one cycle. This problem can be fixed by reducing the value of Ts. Below is an example of this fix:
F0 =13; T0 =1/F0; Ts = 0.001; t = 0:Ts:13*T0; x = real(exp(j*(2*pi*F0*t-pi/2))); plot(t,x)