Revision as of 17:05, 11 September 2008 by Pjcannon (Talk)

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

Homework 2_ECE301Fall2008mboutin - A - B - C - D - E

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

Recent Math PhD now doing a post-doctorate at UC Riverside.

Kuei-Nuan Lin