PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

Fourier and Laplace 387


F _ rms = norm(c./sqrt(2));
% Pave calculations
Pave = (F _ rms^2)/5;
% Perc. of total harmonic distortion calculations
a = c(1);c(1)=[];
PTHD = (norm(c)/a)*100;m=1:10;
disp(‘**********************************************’)
disp(‘***************R E S U L T S******************’)
disp(‘**********************************************’)
disp(‘The Fourier Series coefficients are:’)
disp(‘ Harmonics coef. values’)
[m’ C’]
fprintf(‘The rms value (in volts) of f(t) is: %8.3f\n’,F _ rms)
fprintf(‘The Pave of f(t) is: %8.3f watt\n’,Pave)
fprintf(‘The percentage of total harmonic distortion is: %8.3f\n’,PTHD)
% calculations of % of total power in each harmonic
P = p.*100./sum(p);stem(m,P)
xlabel (‘harmonics in rad/sec’)
ylabel (‘% of total power in each harmonic’)
title(‘[% of total power in each harmonic] vs harmonics’)
axis([-1 10 0 80]);grid on
disp(‘***********************************************’)
disp(‘*****************Check results*****************’)
disp(‘***********************************************’)
disp(‘The total % power in the first 10 harmonics is=’)
sum(P)
disp(‘ percent ’)
disp(‘***********************************************’)

The script fi le Fourier_applic is executed and the results are indicated in the following
(Figure 4.38):

>> Fourier _ applic
************************************************
***************R E S U L T S ******************
************************************************
The Fourier Series coefficients are:
Harmonics coef. values
ans =
1.0000 -0.3183
2.0000 -0.1592
3.0000 -0.1061
4.0000 -0.0796
5.0000 -0.0637
6.0000 -0.0531
7.0000 -0.0455
8.0000 -0.0398
9.0000 -0.0354
10.0000 -0.0318
The rms value (in volts) of f(t) is : 0.280
The Pave of f(t) is: 0.016 watt
The percentage of total harmonic distortion is: 74.146
**************************************************
Free download pdf