0% found this document useful (0 votes)
62 views3 pages

Fir High Pass Flter: Program

This document provides MATLAB code to design FIR high pass and low pass filters. The code takes in parameters like passband ripple, stopband ripple, passband frequency, stopband frequency, and sampling frequency. It then calculates the filter order and designs an FIR filter using the fir1 function with a boxcar window. The code plots the amplitude and phase response of the designed filters.

Uploaded by

Vineeth Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
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)
62 views3 pages

Fir High Pass Flter: Program

This document provides MATLAB code to design FIR high pass and low pass filters. The code takes in parameters like passband ripple, stopband ripple, passband frequency, stopband frequency, and sampling frequency. It then calculates the filter order and designs an FIR filter using the fir1 function with a boxcar window. The code plots the amplitude and phase response of the designed filters.

Uploaded by

Vineeth Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 3

13.

FIR HIGH PASS FLTER


Aim:-write a MATLAB program to obtain FIR High Pass Filter PROGRAM clear all close all clc rp=input('enter passband ripple:'); rs=input('enter stop band ripple:'); fp=input('passband frequency:'); fs=input('stopband frequency:'); f=input('sampling frequency:'); wp=2*fp/f; ws=2*fs/f; num=-20*log10(sqrt(rp*rs))-13; dem=14.6*(fs-fp)/f; n=ceil(num/dem); n1=n+1; if(rem(n,2)~=0) n1=n; n=n-1; end y=boxcar(n1);b=fir1(n,wp,'high',y); [h o]=freqz(b,1,256); subplot(2,1,1) plot(o/pi,abs(h)) title('amplitude plot') xlabel('frequency') ylabel('gain') grid on subplot(2,1,2) plot(o/pi,angle(h)) title('phase plot') xlabel('frequency'), ylabel('angle'), grid on

12. FIR LOW PASS FLTER


Aim:-write a MATLAB program to obtain FIR Low Pass Filter PROGRAM clear all close all clc rp=input('enter passband ripple:'); rs=input('enter stop band ripple:'); fp=input('passband frequency:'); fs=input('stopband frequency:'); f=input('sampling frequency:'); wp=2*fp/f; ws=2*fs/f; num=-20*log10(sqrt(rp*rs))-13; dem=14.6*(fs-fp)/f; n=ceil(num/dem); n1=n+1; if(rem(n,2)~=0) n1=n; n=n-1; end y=boxcar(n1); b=fir1(n,wp,'low',y); [h o]=freqz(b,1,256); subplot(2,1,1) plot(o/pi,abs(h)) title('amplitude plot') xlabel('frequency') ylabel('gain') grid on subplot(2,1,2) plot(o/pi,angle(h)) title('phase plot') xlabel('frequency'), ylabel('angle'), grid on

You might also like