(Finding the Bug)
 
(One intermediate revision by the same user not shown)
Line 16: Line 16:
 
</pre>
 
</pre>
  
Is that the sample rate Ts is incorrect. In the example Ts is too large and should be at close 0.01 instead. The current sampling rate causes matlab to take points the signal are at distances between the points greater than the period of the waveform. As a result it does not produce the correct plot.
+
Is that the sample rate Ts is incorrect. In the example Ts is too large and should be less than 1/26 instead. The current sampling rate causes matlab to take points the signal are at distances between the points greater than the half of the period of the waveform. As a result it does not produce the correct plot.

Latest revision as of 12:08, 11 September 2008

Finding the Bug

The code below is suppose to plot 13 cycles of a sinusoidal wave. However there is a problem with the code. The problem in the following 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)

Is that the sample rate Ts is incorrect. In the example Ts is too large and should be less than 1/26 instead. The current sampling rate causes matlab to take points the signal are at distances between the points greater than the half of the period of the waveform. As a result it does not produce the correct plot.

Alumni Liaison

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

Dr. Paul Garrett