Revision as of 15:39, 11 September 2008 by Pjcannon (Talk)

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)

Alumni Liaison

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

Buyue Zhang