Line 16: Line 16:
  
 
This code is wrong because the sampling frequency, Ts, is to large to get an accurate recreation of the
 
This code is wrong because the sampling frequency, Ts, is to large to get an accurate recreation of the
signal. I fixed this bug by reducing the sampling time by a factor of 20-- Ts=.05*T0.
+
signal. I fixed this bug by reducing the sampling time by a factor of 20.
  
 
<pre>
 
<pre>
Line 24: Line 24:
 
t  = 0:Ts:13*T0;
 
t  = 0:Ts:13*T0;
 
x  = real(exp(j*(2*pi*F0*t-pi/2)));
 
x  = real(exp(j*(2*pi*F0*t-pi/2)));
 +
</pre>
  
 
Now the output looks like this:
 
Now the output looks like this:
Line 29: Line 30:
 
[[Image: Ece301_Hw2B.jpg _ECE301Fall2008mboutin| Fixed Plot]]
 
[[Image: Ece301_Hw2B.jpg _ECE301Fall2008mboutin| Fixed Plot]]
 
plot(t,x)
 
plot(t,x)
</pre>
 

Revision as of 08:04, 10 September 2008

This is the original 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)

It outputs:

Original Plot

This code is wrong because the sampling frequency, Ts, is to large to get an accurate recreation of the signal. I fixed this bug by reducing the sampling time by a factor of 20.

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

Now the output looks like this:

Fixed Plot plot(t,x)

Alumni Liaison

Followed her dream after having raised her family.

Ruth Enoch, PhD Mathematics