Revision as of 15:12, 10 September 2008 by Shamilto (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Find the Bug

The following MATLAB program attempts to plot 13 cycles of a 13 Hz sinusoid, but it has a bug. Explain what the bug is, and modify the above code to fix this bug.

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)

This code is sampling at far to slow of a rate, in fact it is sampling at approximately the same time intervals as the period of the wave.

My solution is to significantly increase the sampling rate of (t) by decreasing the time intervals it samples at (Ts) by at least a factor of 10 (more if you want more precise results).

Alumni Liaison

Questions/answers with a recent ECE grad

Ryne Rayburn