(New page: ==The Problem== The following code has a bug that prevents it from working properly. <pre> 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) </pre...)
 
 
Line 13: Line 13:
 
==The Solution==
 
==The Solution==
 
Ts is much too large for this application.  The value of 0.07 that is given in the original code is nearly the size of one cycle.  Reducing Ts by a factor of 100 would greatly help.
 
Ts is much too large for this application.  The value of 0.07 that is given in the original code is nearly the size of one cycle.  Reducing Ts by a factor of 100 would greatly help.
 +
 +
The final code should look something like this:
 +
 +
<pre>
 +
F0 =13;
 +
T0 =1/F0;
 +
Ts = 0.0007;
 +
t  = 0:Ts:13*T0;
 +
x = real(exp(j*(2*pi*F0*t-pi/2)));
 +
plot(t,x)
 +
</pre>

Latest revision as of 07:52, 9 September 2008

The Problem

The following code has a bug that prevents it from working properly.

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 Solution

Ts is much too large for this application. The value of 0.07 that is given in the original code is nearly the size of one cycle. Reducing Ts by a factor of 100 would greatly help.

The final code should look something like this:

F0 =13;
T0 =1/F0;
Ts = 0.0007;
t  = 0:Ts:13*T0;
x = real(exp(j*(2*pi*F0*t-pi/2)));
plot(t,x)

Alumni Liaison

has a message for current ECE438 students.

Sean Hu, ECE PhD 2009