Thursday, July 14, 2011

DSP Lab Programs 4,5,6,7,8,9

Dear All Students,

    By now all the batches have done:

Introduction to Matlab
1. Generating Sinusoidal Signals and Performing Summation and finding its harmonics
2. Verifying Linear Convolution
3. Performing N-Point FFT

Those who have not yet completed, complete them by saturday i.e 16-07-2011 and get observations corrected by the mentioned date.

Now I am giving some more programs. Copy them directly in observations and get them to lab and do them in the lab and after doing the experiment get the observations signed.

4. Matlab program to find frequency response of FIR LPF using Rectangular Window

 

Program:

 

n=10;

fp=200;

fr=300;

fs=1000;

fn=2*fp/fs;

window=rectwin(n+1);

b=fir1(n,fn,window);

[h,w]=freqz(b,1,128);

Gain=abs(h);

an=angle(h);

subplot(2,1,1);

plot(w/pi,gain);

title('Normal Magnitude response of LPF');

xlabel('Normalized Frequency');

ylabel('gain in db');

subplot(2,1,2);

plot(w/pi,an);

title('Phase response of LPF');

xlabel('Normalized Frequency');

ylabel('Angle');

 

 

 

5. Matlab Program to find frequency response of FIR Highpass using BLACKMAN window

 

Program:

 

n=10;

fp=200;

fr=300;

fs=1000;

fn=2*fp/fs;

window=blackman(n+1);

b=fir1(n,fn,'high',window);

[h,w]=freqz(b,1,128);

Gain=abs(h);

an=angle(h);

subplot(2,1,1);

plot(w/pi,gain);

title('Normal Magnitude response of HPF');

xlabel('Normalized Frequency');

ylabel('gain in db');

subplot(2,1,2);

plot(w/pi,an);

title('Phase response of HPF');

xlabel('Normalized Frequency');

ylabel('Angle');

 

 

6. Matlab Program to find frequency Response of FIR LPF using Blackman Window

 

Program:

 

n=10;

fp=200;

fr=300;

fs=1000;

fn=2*fp/fs;

window=blackman(n+1);

b=fir1(n,fn,window);

[h,w]=freqz(b,1,128);

Gain=abs(h);

an=angle(h);

subplot(2,1,1);

plot(w/pi,gain);

title('Normal Magnitude response of LPF');

xlabel('Normalized Frequency');

ylabel('gain in db');

subplot(2,1,2);

plot(w/pi,an);

title('Phase response of LPF');

xlabel('Normalized Frequency');

ylabel('Angle');

 

7. Matlab Program to find frequency response of FIR LPF using Hamming Window

 

n=10;

fp=200;

fr=300;

fs=1000;

fn=2*fp/fs;

window=hamming(n+1);

b=fir1(n,fn,window);

[h,w]=freqz(b,1,128);

Gain=abs(h);

an=angle(h);

subplot(2,1,1);

plot(w/pi,gain);

title('Normal Magnitude response of LPF');

xlabel('Normalized Frequency');

ylabel('gain in db');

subplot(2,1,2);

plot(w/pi,an);

title('Phase response of LPF');

xlabel('Normalized Frequency');

ylabel('Angle');

 

 

8. Matlab Program to find frequency response of FIR LPF using Hanning Window

 

n=10;

fp=200;

fr=300;

fs=1000;

fn=2*fp/fs;

window=hann(n+1);

b=fir1(n,fn,window);

[h,w]=freqz(b,1,128);

Gain=abs(h);

an=angle(h);

subplot(2,1,1);

plot(w/pi,gain);

title('Normal Magnitude response of LPF');

xlabel('Normalized Frequency');

ylabel('gain in db');

subplot(2,1,2);

plot(w/pi,an);

title('Phase response of LPF');

xlabel('Normalized Frequency');

ylabel('Angle');

 

9. Matlab Program to find frequency response of FIR LPF using Triangular Window

 

n=10;

fp=200;

fr=300;

fs=1000;

fn=2*fp/fs;

window=triang(n+1);

b=fir1(n,fn,window);

[h,w]=freqz(b,1,128);

Gain=abs(h);

an=angle(h);

subplot(2,1,1);

plot(w/pi,gain);

title('Normal Magnitude response of LPF');

xlabel('Normalized Frequency');

ylabel('gain in db');

subplot(2,1,2);

plot(w/pi,an);

title('Phase response of LPF');

xlabel('Normalized Frequency');

ylabel('Angle');

 

Write the Programs in the Observations and get it signed after doing in the lab.

By next week end everyone should complete these programs.


with regards,

B V K

 

5 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Where ever all should be Gain or gain

    ReplyDelete
  3. Here in Matlab

    'A' is different from 'a'

    so 'Gain' and 'gain' are diff..!

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. if u r writing Gain then write everywhere as Gain or if you are writing gain then write gain everywhere man. Matlab is case sensitive, so represent everything in one format only. The problem arised because i have written code in MS Word. so, every new line is going to start with a capital letter. I have changed many but few are left like that. However you spotted the error okay good.

    with regards,
    B V K.

    ReplyDelete