(New page: The following MATLAB code has a bug in it: <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 bug is that Ts is far too large. D...)
 
 
Line 10: Line 10:
 
</pre>
 
</pre>
  
The bug is that Ts is far too large.  Dividing by either 100 or 1000 will greatly improve the situation.  The fixed code looks like
+
The bug is that Ts is far too large and results in poor resolution.  Dividing by either 100 or 1000 will greatly improve the situation.  The fixed code looks like
  
 
<pre>
 
<pre>

Latest revision as of 16:13, 11 September 2008

The following MATLAB code has a bug in it:

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 bug is that Ts is far too large and results in poor resolution. Dividing by either 100 or 1000 will greatly improve the situation. The fixed code looks like

F0 =13;
T0 =1/F0;
Ts = 0.0007;
t  = 0:Ts:13*T0;
x = real(exp(j*(2*pi*F0*t-pi/2)));
plot(t,x)

Or

F0 =13;
T0 =1/F0;
Ts = 0.00007;
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