(New page: ==Problem with MATLAB Code== <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> The problem with the above MATLAB code is that the ...)
 
 
(2 intermediate revisions by the same user not shown)
Line 9: Line 9:
 
</pre>
 
</pre>
  
The problem with the above MATLAB code is that the time vector interval (0.07) is too small compared to the period of the signal which is 1/13 <math>\approx</math> 0.0769
+
The problem with the above MATLAB code is that the time vector interval Ts = 0.07 sec is too small compared to the period of the signal which is 1/13 <math>\approx</math> 0.0769 sec. This bug can be fixed by letting Ts = 0.001 sec:
 +
 
 +
<pre>
 +
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)
 +
</pre>
 +
 
 +
The result is the desired graph of 13 cycles:
 +
 
 +
[[Image:13HzCorrect_ECE301Fall2008mboutin.JPG]]

Latest revision as of 13:13, 11 September 2008

Problem with MATLAB 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 problem with the above MATLAB code is that the time vector interval Ts = 0.07 sec is too small compared to the period of the signal which is 1/13 $ \approx $ 0.0769 sec. This bug can be fixed by letting Ts = 0.001 sec:

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)

The result is the desired graph of 13 cycles:

13HzCorrect ECE301Fall2008mboutin.JPG

Alumni Liaison

To all math majors: "Mathematics is a wonderfully rich subject."

Dr. Paul Garrett