Line 7: | Line 7: | ||
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) | ||
</pre> | </pre> | ||
Line 21: | Line 22: | ||
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) | ||
</pre> | </pre> |
Latest revision as of 11:08, 12 September 2008
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)
The problem with this code is that since its current frequency is 13 Hz, this causes a problem with the timestep of a Discrete Time signal which shows why there is a bug in this code. The timestep in this case makes the part of the signal that is plotted is considered to small to get a full sample.
In order to fix this code I have referenced Aishwar Sabesan to see values of a new timestep to use to save time (I could have figured it out on my own but I would rather have values in the ballpark before I began)
From his reference i decided to use a new timestep of Ts/10000. which turns out to be .07/10000 for my deltaT
F0=13; T0=1/F0; Ts=0.07/10000; t=0:Ts:13:T0; x=real(exp(j*(2*pi*F0*t-pi/2))); plot(t,x)