(New page: This is the original code: <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> This code is wrong because the sampling frequency, ...) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 9: | Line 9: | ||
x = real(exp(j*(2*pi*F0*t-pi/2))); | x = real(exp(j*(2*pi*F0*t-pi/2))); | ||
plot(t,x) | plot(t,x) | ||
− | < | + | </pre> |
− | This code is wrong because the sampling frequency, Ts, is to large to | + | It outputs: |
− | signal. | + | |
+ | [[Image: Ece301_Hw2B_messedUP.jpg _ECE301Fall2008mboutin| Original Plot]] | ||
+ | |||
+ | This code is wrong because the sampling frequency, Ts, is to large to produce an accurate recreation of the | ||
+ | signal. I fixed this bug by reducing the sampling time by a factor of 20. | ||
<pre> | <pre> | ||
F0 = 13; | F0 = 13; | ||
T0 = 1/F0; | T0 = 1/F0; | ||
− | Ts = . | + | Ts = .05*T0; |
t = 0:Ts:13*T0; | t = 0:Ts:13*T0; | ||
x = real(exp(j*(2*pi*F0*t-pi/2))); | x = real(exp(j*(2*pi*F0*t-pi/2))); | ||
plot(t,x) | plot(t,x) | ||
− | < | + | </pre> |
− | + | ||
+ | Now the output looks like this: | ||
+ | |||
+ | [[Image: Ece301_Hw2B.jpg _ECE301Fall2008mboutin| Fixed Plot]] |
Latest revision as of 08:05, 10 September 2008
This is the original 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)
It outputs:
This code is wrong because the sampling frequency, Ts, is to large to produce an accurate recreation of the signal. I fixed this bug by reducing the sampling time by a factor of 20.
F0 = 13; T0 = 1/F0; Ts = .05*T0; t = 0:Ts:13*T0; x = real(exp(j*(2*pi*F0*t-pi/2))); plot(t,x)
Now the output looks like this: