386 Practical MATLAB® Applications for Engineers
Example 4.3
Let the FS expansion for a periodic sawtooth wave be given by
ft()
11
1
6
n nw t^0
n
∑ sin ( )
(same as in Example 4.2)
with period T = 2 s, and fundamental frequency given by w 0 = 2 π/T = π.
Let f(t) represent the voltage drop across a resistor R = 5 Ω. Create the script fi le
Fourier_ applic that returns the following:
- The fi rst 10 FS coeffi cients
- Its RMS value
- The percentage of the total harmonic distortion
- The average power dissipated by R = 5 Ω
- The power concentrated in the fi rst 10 harmonics
- The plot of the percentage of total power (dissipated) versus its harmonic
frequencies - Check the % of total power dissipated in the fi rst 10 harmonics.
MATLAB Solution
% Script file: Fourier _ applic
% Calculations of the Fourier coefficient
for n = 1:10;
c(n) = -1/(n*pi);
p(n) = c(n).^2;
end
C = c;
% RMS calculations
FIGURE 4.37
Plots of part e of Example 4.2.
error1(t) = sawtooth wave-harmonics 1
error3(t) = sawtooth wave-harmonics 1,2,3
error5(t) = sawtooth wave-harmonics 1,2,3,4,5
error2(t) = sawtooth wave-harmonics 1,2
error4(t) = sawtooth wave-harmonics 1,2,3,4
error6(t) = sawtooth wave-harmonics 1,2,3,4,5,6
0.5
0.5
−0.5
−0.5
0
0
0.5
−0.5
0
0.5
−0.5
0
0.5
−0.5
0
0.5
−0.5
0
Amplitude
Amplitude
Amplitude
Amplitude
Amplitude
Amplitude
01 2 3 4
01 23 4
01 23 4
time (in sec) time (in sec)
0123 4
0123 4
0123 4