PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

Fourier and Laplace 391


− 2 − 1 012
time (in sec)

0.2

−0.2

0

Fifth harmonic

Third harmonic
0.5

−0.5− 2 − 1

0

012

− 2 − 1 012

1

− 1

0

DC component Fundamental frequency

Second harmonic

2
1

− 1

0
Amplitude (FO)

Amplitude of F2 Amplitude of F3

Amplitude of F4 Amplitude of F5

Amplitude of F1
− 2 012

5

− 5

− 5

0

− 2

− 2 − 1

− 1

− 1

01

012

5 Fourth harmonic

0

2
time (in sec)

× 10 −^17

× 10 −^17

FIGURE 4.40
Plots of part a of Example 4.4.

disp(‘ ’);
syms x;
intft = 1/2*int(‘Heaviside(x+.5)’,-.5,.5);
Pavesym = vpa(intft);
disp(‘ ’);
disp(‘*********************************’);
disp(‘ ’);
disp(‘The average power using integration in time is:’);
vpa(intft)
disp(‘ ’);
disp(‘*********************************’);
disp(‘ ’);
disp(‘The percentage error is :’); % parts (2g)
error = (Pavesym-Pave)*100/Pavesym;disp(error)
disp(‘ ’);disp(‘**********************************’);
The script fi le Fourier_ series is executed and the results are as follows:
>> Fourier _ series
*************************************************
Verification of Parseval’s theorem
*************************************************
The average power using summation of Fn (coefficients) is:
0.4833
*************************************************
The average power using integration in time is:
ans =
.50000000000000000000000000000000
*************************************************
The percentage error is :
3.3472238873502480061006281175660
**************************************************
Free download pdf