Original Code

The code that follows has a bug.

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)

Problem with Original Code

The problem with the original code is that it cannot plot 13 cycles of the 13Hz sinusoid because the Time Step (Ts) value is much too large since the value of 1 cycle is .0769. Therefore the Time Step must be greatly reduced. Dividing the Time Step by 130 gives us 13 cycles on the plot.

Code with Bug Fixed

F0 =13; 

T0 =1/F0; 

Ts = 0.07/130;

t  = 0:Ts:13*T0; 

x = real(exp(j*(2*pi*F0*t-pi/2)));

plot(t,x)

Alumni Liaison

Ph.D. 2007, working on developing cool imaging technologies for digital cameras, camera phones, and video surveillance cameras.

Buyue Zhang