(New page: ==Bugged Code== The bugged code: <pre> F0 =13; T0 =1/F0; Ts = 0.007; t = 0:Ts:13*T0; x = real(exp(j*(2*pi*F0*t-pi/2))); plot(t,x) </pre> Outputs: Image:Ccadwall-buggedcode.jpg)
 
(Bugged Code)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Bugged Code==
+
==PART B: Bugged Code==
  
 
The bugged code:
 
The bugged code:
Line 15: Line 15:
 
Outputs:
 
Outputs:
  
[[Image:Ccadwall-buggedcode_ECE301Fall2008mboutin.jpg]]
+
[[Image:Ccadwall-buggedwave_ECE301Fall2008mboutin.jpg]]
 +
 
 +
 
 +
From the graph it appears that the frequency is a little less than one but the problem statement
 +
and the function indicates its a 13Hz sinusoid. The samples are not frequent enough and go beyond one period. To fix this code Ts must be decreased to a reasonably small value to improve the accuracy of the graph.
 +
 
 +
Fixed code and output:
 +
 
 +
 
 +
<pre>
 +
F0 =13;
 +
T0 =1/F0;
 +
Ts = 0.00007;
 +
t  = 0:Ts:13*T0;
 +
x = real(exp(j*(2*pi*F0*t-pi/2)));
 +
plot(t,x)
 +
</pre>
 +
 
 +
[[Image:Ccadwall-buggedwavefixed_ECE301Fall2008mboutin.jpg]]

Latest revision as of 05:43, 12 September 2008

PART B: Bugged Code

The bugged code:


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

Outputs:

Ccadwall-buggedwave ECE301Fall2008mboutin.jpg


From the graph it appears that the frequency is a little less than one but the problem statement and the function indicates its a 13Hz sinusoid. The samples are not frequent enough and go beyond one period. To fix this code Ts must be decreased to a reasonably small value to improve the accuracy of the graph.

Fixed code and output:


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

Ccadwall-buggedwavefixed ECE301Fall2008mboutin.jpg

Alumni Liaison

Basic linear algebra uncovers and clarifies very important geometry and algebra.

Dr. Paul Garrett