Line 1: Line 1:
 +
 +
== Bugged Code ==
 +
 
<pre>
 
<pre>
 
F0 =13;  
 
F0 =13;  
Line 7: Line 10:
 
plot(t,x)
 
plot(t,x)
 
</pre>
 
</pre>
 +
 +
 +
== 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:
 
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:

Revision as of 16:39, 11 September 2008

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

Basic linear algebra uncovers and clarifies very important geometry and algebra.

Dr. Paul Garrett