Numerical Evaluation of Fourier Coefficients

7.12 Numerical Evaluation of Fourier Coefficients

The use of Fourier series is not restricted to electric circuit analysis. It is also applied in the analysis of the behavior of physical systems subjected to periodic disturbances. Examples include cable stress analysis in suspension bridges, and mechanical vibrations.

Quite often, it is necessary to construct the Fourier expansion of a function based on observed val- ues instead of an analytic expression. Examples are meteorological or economic quantities whose

7-44

Signals and Systems with MATLAB Applications, Second Edition Orchard Publications

Numerical Evaluation of Fourier Coefficients

period may be a day, a week, a month or even a year. In these situations, we need to evaluate the inte- gral(s) using numerical integration.

The procedure presented here, will work for both the waveforms that have an analytical solution and those that do not. Even though we may already know the Fourier series from analytical methods, we can use this procedure to check our results.

Consider the waveform of fx () shown in Figure 7.44, were we have divided it into small pulses of width ∆x . Obviously, the more pulses we use, the better the approximation.

If the time axis is in degrees, we can choose ∆x to be 2.5 ° and it is convenient to start at the zero point of the waveform. Then, using a spreadsheet, such as Microsoft Excel, we can divide the period

0 ° to 360 ° in 2.5 ° intervals, and enter these values in Column of the spreadsheet. A

fx ()

Figure 7.44. Waveform whose analytical expression is unknown

Since the arguments of the sine and the cosine are in radians, we multiply degrees by (3.1459...) π and divide by 180 to perform the conversion. We enter these in Column and we denote them as B

x . In Column we enter the corresponding values of C y = fx () as measured from the waveform. In Columns and we enter the values of D E cos x and the product y cos x respectively. Similarly, we

enter the values of sin x and y sin x in Columns and respectively. F G

Next, we form the sums of y cos x and y sin x , we multiply these by ∆x , and we divide by to π obtain the coefficients a 1 and b 1 . To compute the coefficients of the higher order harmonics, we

form the products y cos 2x ,, ,, y sin 2x y cos 3x y sin 3x and so on, and we enter these in subsequent columns of the spreadsheet.

Figure 7.45 is a partial table showing the computation of the coefficients of the square waveform, and Figure 7.46 is a partial table showing the computation of the coefficients of a clipped sine wave- form. The complete tables extend to the seventh harmonic to the right and to 360 ° down.

Signals and Systems with MATLAB Applications, Second Edition

7-45

Orchard Publications

7-46

Chapter 7 F

Analytical:

F igur

1.5 Square waveform

f(t)=4(sinwt/p+sin3wt/3p+sin5wt/5p+ ….)

urier Series

umerical computation of

Signals and Systems wit the coe

x(deg) x(rad) y=f(x) 0.5*a0 cosx

cos2x ycox2x sin2x

ysin2x

cos3x ycos3x

sin3x ysin3x

fficients of the

A e waveform (partial

c 27.5 0.480 1.000 0.044 0.887 0.887 0.462 0.462 0.574 0.574 0.819 0.819 0.131 0.131 0.991 0.991 Or

ations, Second E

d Publications

ition d 45.0 0.785 1.000 0.044 0.707 0.707 0.707 0.707 0.000 0.000 1.000 1.000 -0.707 -0.707 0.707 0.707 47.5 0.829 1.000 0.044

0.676 0.737 0.737 -0.087 -0.087 0.996

0.643 0.766 0.766 -0.174 -0.174 0.985

-0.866 -0.866

Or Signals and Systems with MA ch

ar Figur

Analytical:

dP e 7.46. 1.5

Sine wave clipped at π/6, 5π/6 etc.

f(t)=unknown

tion a N

umerical computation of

LAB Applicat

b7= -0.010

ions, the coeffic

Numerical Ev

x(deg) x(rad) y=f(x) 0.5*a 0 cosx

cos2x ycox2x sin2x

ysin2x cos3x ycos3x

sin3x ysin3x

Second Edition

ients of a

clipped si

aluation of

0.866 ne waveform (partial 0.296

Fo

rie

rC

c ffi

0.707 7-47 0.354

ie

0.369 -0.087 -0.044

ts

0.383 -0.174 -0.087

0.492 -0.866

Chapter 7 Fourier Series