Sie sind auf Seite 1von 3

Gleb Danilchenko EE 3512: Signals

Midterm 1, Question 3 Question #3, Fourier Series

We can first examine the signal as three different parts, as F(t) = 1 from 0 < t < T/4, then as F(t) = -1 from T/4 < t < T/2, and last as F(t) = 0 from T/2 < t < T. Since this piecewise function is neither even nor odd over the y-axis, we need to compute both the An and Bn terms in the Fourier series. Also, from inspection we can see that the average value of F(t) over the period T is zero, hence the A0 term is zero. In MATLAB, this is easily verified by A0 = (2/T)*(int(1,t,0,T/4)-int(1,t,T/4,T/2)); which equates to zero. Since the function is zero for the second part of the period T, we need only to compute two integrals for each of the An and Bn terms, both shown in the analytical solution and MATLAB code. Using the Symbolic Toolbox with MATLAB, we can set our time (t) and number of divisions (n) to a symbolic variable, and then compute each piecewise integral for An and Bn, with the period T being any value or by making T symbolic. From there, we can easily create an F function that is An*cos(n*w0*t) +Bn*sin(n*w0*t), after this we need to perform the summation over M number of terms to clear the n variable out of F. By choosing more M terms, the computation takes longer in MATLAB, but will produce a more accurate result. The graphs below show examples of F(t) that is the result of summing the previous F from 10, 50, and 100 terms. To create the graph of each An, Bn, and combined Cn terms, we can create a for loop, from i = 1 to M, to store the value of the respective term when n = i, by solving the symbolic Cn at that n value, then storing it into a double type matrix. What the result is when we plot stem(CnValue), is the amplitudes of Cn at each of the harmonics in the series, the plots of An and Bn are also shown. Both results verify the analytical solution, we see that An has a zero value at even harmonics, and Bn has a pattern of a value at n = 2, then each next fourth harmonic, while the rest are zero. Analytical Solution To = T so Wo = 2 /T; A0 = 2/T f (t ) * cos( n 2t / T ) dt
0 T /4 T

Since cos(2 t) is an even function, A0 = 0.


T /2

An = 2 / T

(1) * cos( n 2t / T )dt - 2 / T


T /4

An = 1 / n[(sin( n / 2)) ] - 2 / n[sin( n) sin( n / 2)] sin An = 1 / n[sin( n / 2) ( n) +sin( n / 2)] sin An = 1 / n[2 * sin( n / 2) ( n)] An = 0 for when n is even. An = 2 / n for n = 1, 5, 9, 13 etc An = - 2 / n for n = 3, 7, 11, 15 etc
T /4

An = 2 / T [ (T / n 2 ) * (sin( n 2t / T )) ] 0

- 2 / T [ (T / n 2 ) * (sin( n 2t / T )) ] T / 4
T /2

T /4

(1) * cos( n 2t / T )dt

Bn = 2 / T

(1) * sin( n 2t / T )dt - 2 / T

T /2

T /4

(1) * sin( n 2t / T )dt

Gleb Danilchenko EE 3512: Signals


T /4

Midterm 1, Question 3 Question #3, Fourier Series


T /2

Bn = 2 / T [(T / n 2 ) * (cos( n 2t / T )) ] 0 + 2 / T [ (T / n 2 ) * (cos( n 2t / T )) ] T / 4 Bn = 1 / n[cos( n / 2)+1 +cos( n) cos( n / 2)] Bn = 1 / n[2 cos( n/ 2)+cos( n) +1] = 1 / n[cos( n) 2 cos( n / 2)+1] Bn = 0 for n = 1, 3, 4, 5, 7, 8, etc. Bn = 2 /(( n / 2)) for n = 2, 6, 10, 14, etc.

F(t) =

c o2 *st / T() 1/ 3* c o6 *st / T() + 1/ 5* c o1 s0*t /(T ) + . . . 2 / . . . s i4 n* t /(T ) + 1/ 3s i (1n 2* t / T ) + 1/ 5* s i2 n 0* t(/ T ) + 1/ 7 * s i2 n 8* t(/ T )

Produced Results

Cn (top), An (left), and Bn (right) values.

Graphs of F(t), period 4 , with 10, 50, and 100 summations.

Gleb Danilchenko EE 3512: Signals

Midterm 1, Question 3 Question #3, Fourier Series

Matlab Code clear all;

% Clear variables and functions from memory. clc; % Clear command window. syms n t; T = sym('4*pi'); w0 = 2*pi/T; M = 50; A0 = (2/T)*(int(1,t,0,T/4) int(1,t,T/4,T/2)); % Integral An from 0 - T/4 % Integral An from T/4 - T/2; An1 = (2/T)*int( 1*cos(t*n*w0), t, 0, T/4); An2 = (2/T)*int(-1*cos(t*n*w0), t, T/4, T/2); An = An1 + An2; % Integral Bn from 0 - T/4 % Integral Bn from 0 - T/4; Bn1 = (2/T)*int( 1*sin(t*n*w0), t, 0, T/4); Bn2 = (2/T)*int(-1*sin(t*n*w0), t, T/4, T/2); Bn = Bn1 + Bn2; F = simplify(An*cos(n*w0*t) + Bn*sin(n*w0*t)); % Cn = simplify(sqrt(An^2 + Bn^2)); %% Calculates An line spectra AnValue = zeros([1 M]); for i=1:1:M AnValue(i) = double(limit(An, i)); end %% Calculates Bn line spectra BnValue = zeros([1 M]); for i=1:1:M BnValue(i) = double(limit(Bn, i)); end %% Calculates the Cn line spectra CnValue = zeros([1 M]); for i=1:1:M CnValue(i) = sqrt(AnValue(i)^2 + ... BnValue(i)^2); end

%% Plots F(t), reconstructed with M summations, period of 4pi figure(1);set(1,'Name','F(t) reconstructed'); Ft = symsum(F,n,1,M); ezplot(Ft, [0:8*pi]);grid off; %% Plot Cn values figure(2);set(2,'Name','Cn values'); subplot(2,2,1:2); stem(CnValue,'LineWidth',1.5); xlabel('n');ylabel('Cn amplitudes');grid; % Plot An values subplot(2,2,3); stem(AnValue,'LineWidth',1.5); xlabel('n');ylabel('An amplitudes');grid; % Plot Bn values subplot(2,2,4); stem(BnValue,'LineWidth',1.5); xlabel('n');ylabel('Bn amplitudes');grid;

Das könnte Ihnen auch gefallen