FOURIER SERIES Objective : 1. To show that any periodic function (or signal) can be represented as a series of sinusoidal (or complex exponentials) function. 2. To show and to study hot to approximate periodic functions using a finite number of sinusoidal function and run the simulation using MATLAB.

Scope : In experiment 1, students need to learn using MATLAB by connect it with Fourier series, where students must know how the output changes as higher order terms are added. Students must know to plot the graph.Besides, students must know to add instruction in appropriate line to plot frequencies versus coefficient for each wave form. Equipment : MATLAB software. Experiment 1 : Fourier Series Generally, student must know the basic concept of Fourier series. General form : [pic] Where : [pic] [pic] For example, x(t) with the highest harmonic value = 2.

[pic] Task 1 : Simulate Using MATLAB Procedure : Table 1 shows coefficient for complex exponential fourier series of half rectified sine wave with A=1, T=1. Wave form |Fourier Coefficients | |Half-rectified sine wave: |[pic] | Table 2-1 : Complex Exponential Fourier Series of Half-rectified Sine Wave. Execute program in Listing 1 using 4 inputs : [2 8 20 100]. Listing 1 : • Program to give partial complex exponential fourier sums of a half rectified sine wave of unit amplitude in table 2-1.

clear clc _max = input (‘Enter vector of highest harmonic values desired (even only) >>’); num_kmax = length (k_max); for z = 1 : num_kmax k = [-k_max (z) : k_max (z)]; L_k = length (k); a_k = zeros (1, L_k);% Form vector of fourier series coefficients, a_k ((L_k+1)/2+1) = -0. 25*j;% all odd-terms are zero except A(1) a_k((L_k+1)/2-1) = 0. 25*j;% and A(-1) so define coefficient array for i =1 : 2 : L_k%as a zero array and then a_k (i) = 1/(pi*(1-k(i)^2));% fill in nonzero values end; omega_0 = 2*pi; t = 0 : 0. 005 : 3; x = a_k*exp(j*omega_0*k’*t); ubplot(num_kmax, 1, z), plot (t, real (x)), ylabel (‘partial sum’),… axis ([0 3 -0. 5 1.

2]), text (0. 05, -0. 25, [‘max. har. = ‘, num2str(k_max(z))]),… text (2. 0, -0.

25, [‘Nur Izzah Sofiah/B011010437’]), end; xlabel(‘t’); TASK 2 Changes [pic] (in previous Listing 1) with the formula given in the table 2, then run the program. Pay the attention to other instruction that must also be changed. Add several instructions in the appropriate line to plot (stem) frequencies vs coefficient (line spectra) for each wave form.

Full-rectified sine wave: | | | |[pic] | | | | | | | | | | | | | |Triangular wave: | | | |[pic] | | | | | | | | | | | | | |Square wave: |[pic] | | | | | | | | | | | | | Table 2-2 : Coefficient for Complex Exponential Fourier Series of Several Signal for all signals below A=1, T=1. EXPERIMENT 2 : FOURIER TRANSFORM WITH MATLAB SYMBOLIC TOOLBOX Task 1 The MATLAB symbolic toolbox can compute symbolic fourier transforms.Note that for many functions there is no simple expression for the fourier transform and MATLAB will not be able to return a result.

Please add the following m-files in your home directory: 1. Heaviside. m, Dirac. m and setcurve. m ( to fix some plotting problems in MATLAB) As an introduction tu using MATLAB symbolic toolbox, please type the following commands interactively from MATLAB command window and try to understand its function.

>>syms t w % The expression with variable t and w will be treated as symbolic expressions. >> x = sym(‘exp(-2*t)*Heaviside(t)’) % symbolically defines signal x and the result is >> X = fourier (x) X is the symbolic fourier transform (expressed in w) of x and the result is >>Xf = subs(X, ‘2*pi*f’,’w’) % Substitution of w in X by 2? f gives Xf and the result is >>Xf_conj = subs(Xf,’(-i)’,’i’) %Xf_conj is the complex-conjugate of Xf. >>Gf = Xf*Xf_conj >>Gf = simplify(Gf) % Simplifying expression % The following commands are related to plotting command >>subplot(2,1,1) >>ezplot(x,-0. 1,2. 5) >>subplot(2,1,2) >>ezplot(Gf,-2,2) Remarks : To put your identity in the graph : add the text command in command ezplot: >> ezplot(x,-0. 1,2.

5), text(0, 0. 24, [;your name/matrix no’]) The function Heaviside(t) is 0 for t