0% found this document useful (0 votes)
16 views7 pages

Experiment 7

The document outlines a MATLAB program for implementing two types of filters: a low pass filter and a bandstop filter. Each filter requires user input for parameters such as passband ripple, stop band ripple, passband frequency, stopband frequency, and sampling frequency. The program calculates the filter coefficients and plots the magnitude and phase responses for both filters.

Uploaded by

BRIJESH HANSA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views7 pages

Experiment 7

The document outlines a MATLAB program for implementing two types of filters: a low pass filter and a bandstop filter. Each filter requires user input for parameters such as passband ripple, stop band ripple, passband frequency, stopband frequency, and sampling frequency. The program calculates the filter coefficients and plots the magnitude and phase responses for both filters.

Uploaded by

BRIJESH HANSA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Experiment 8(A)

Write a matlab program to implement 4 different filter:


Low pass filter:
clc

clear all

close all

rp=input('enter passband ripple=');%0.23

rs=input('enter stop band ripple=');%47

wp=input('enter passband frequency=');%1300

ws=input('enter stopband frequency =');%1550

fs=input('enter the sampling frequency=');%7800

w1=2*wp/fs;

w2=2*ws/fs;

[n,wn]=cheb1ord(w1,w2,rp,rs);

[b,a]=cheby1(n,rp,wn);

w=0:0.01:pi;

[h,om]=freqz(b,a,w);

m=20*log10(abs(h));

an=angle(h);

subplot(2,1,1);

plot(om/pi,m);

title('magnitude response');
xlabel('normalisd frequency............>');

ylabel('gain in db...............>');

grid on;

subplot(2,1,2);

plot(om/pi,an);

title('phase response');

xlabel('normalised frequency .........>');

ylabel('phase in radians..........>');

grid on;
Experiment -8(d): Bandstop filter:
clc

clear all

close all

rp=input('enter passband ripple=');%0.15

rs=input('enter stop band ripple=');%30

wp=input('enter passband frequency=');%2000


ws=input('enter stopband frequency =');%2400

fs=input('enter the sampling frequency=');%7000

w1=2*wp/fs;

w2=2*ws/fs;

[n]=cheb1ord(w1,w2,rp,rs);

wn=[w1 w2];

[b,a]=cheby1(n,rp,wn,'stop');

w=0:0.01:pi;

[h,om]=freqz(b,a,w);

m=20*log10(abs(h));

an=angle(h);

subplot(2,1,1);

plot(om/pi,m);

title('magnitude response');

xlabel('normalisd frequency............>');

ylabel('gain in db...............>');

grid on;

subplot(2,1,2);

plot(om/pi,an);

title('phase response');

xlabel('normalised frequency .........>');

ylabel('phase in radians..........>');

grid on;

You might also like