Problem

The bug occurs because the sampling rate is too small. The period of the sinusoidal signal given is 1/13 = 0.0769 and the sampling period set is 0.07. It is clear to see that the program only samples once per period printing only one cycle. Therefore, it is necessary to increase the sampling frequency by decreasing the sampling period Ts.

Solution

Here is the debugged MATLAB code

F0 =13;

T0 =1/F0;

Ts = 0.00001;

t = 0:Ts:13*T0;

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

plot(t,x)

Debugged ECE301Fall2008mboutin.jpg

Alumni Liaison

Sees the importance of signal filtering in medical imaging

Dhruv Lamba, BSEE2010