# LAB 01 :Signals and Spectra

This Lab session will guide you to understand the concept of Fourier, by which you can create some really complicated looking waves by just summing up simple sine and cosine waves. For this we use MATLAB which is an is a high-level technical computing language and interactive environment developed by MathWorks, Inc. to facilitate numerical computations as well as some symbolic manipulation. Note:   This Lab session will be counted as a part of your assessment tasks of your Telecommunication Principles course. Save all your m-files and figures in a directory named as your Student ID.

Task 1: plot the fundamental (1Hz) frequency First we create a time vector by typing the following in the Matlab command window >> t=0:.001:4; And then we plot the fundamental frequency as follows, >>y=sin(2*pi*1*t); >>plot(t,y); Task 2: plot the 2nd and 3rd harmonics We create the time vector as we did for the previous task and plot the sine curves with 2nd and 3rd harmonic frequencies. We create an m-file for this. Type the following in the Matlab Editor and save as ‘harmonics.m’

for i=1:3 t=0:.001:5; x=sin(2*pi*i*t); subplot(3,1,i); plot(t,x); end;
in matlab command window type the following and press ‘ENTER’ >> harmonics Observe the result and save the figure as ‘Harmonics.fig’ Task 3: Sum of sinusoidal waves Let’s try summing a bunch of sine waves. For this type the following in the editor window and save as ‘sum_of_sin.m’.

t=0:.001:1; x=sin(2*pi*1*t) +sin(2*pi*2*t) ; plot(t,x);
Here we have added two sine curves with same amplitude. QUS: i).Plot the sum of first five harmonics of sine wave with the 1Hz fundamental frequency. ii). Plot the sum of first three odd harmonics of sine wave with the 1Hz fundamental frequency iii). Plot the sum of first three even harmonics of sine wave with the 1Hz fundamental frequency. Next we try to plot the sum of harmonics with different amplitude. Try the following.

t=0:.001:1; x=sin(2*pi*1*t) +sin(2*pi*2*t)/2 +sin(2*pi*3*t)/3+sin(2*pi*4*t)/4; plot(t,x)
iv). try the above example with cosine function (Use for loop). v). Plot the sum of first five odd harmonics of sine wave with the 1Hz fundamental frequency, and (1/n) as the coefficients of each term. (where n is integer) vi). Plot the sum of first five even harmonics of sine wave with the 1Hz fundamental frequency, and (1/n) as the coefficients of each term. (where n is integer) vii) redo (v) and (vi) with cosine functions Discussion. 1. Comment on the results which you got in (v), (vi), (vii). 2. How can you improve your results to obtain a square wave? 3.write an m-file to implement the following function. Comment on your result.

You Should Submit a printed report, 1.containing all your matlab codes, results, figures. 2.Discussion