(→Bugged Code) |
(→Bugged Code) |
||
Line 1: | Line 1: | ||
− | ==Bugged Code== | + | ==PART B: Bugged Code== |
The bugged code: | The bugged code: |
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:
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)