Showing posts with label filter. Show all posts
Showing posts with label filter. Show all posts

MATLAB program for the design and implementation of Chebyshev low pass filter


Program code
%Chebyshev low pass filter
clc;
clear all;
close all;
fp=input('Please enter the pass band frequency: ');
fs=input('Please enter the stop band frequency: ');
rp=input('Please enter the pass band attenuation: ');
rs=input('Please enter the stop band attenuation: ');
sf=input('Please enter the sampling frequency: ');
wp=2*fp/sf;
ws=2*fs/sf;
[n,wn]=cheb1ord(wp,ws,rp,rs);
[b,a]=cheby1(n,rp,wn,'low');
freqz(b,a);
title('Chebyshev low pass filter');

Example of output

Please enter the pass band frequency: 2000
Please enter the stop band frequency: 1600
Please enter the pass band attenuation: .4
Please enter the stop band attenuation: 50
Please enter the sampling frequency: 8000 


















_________________________________________

If you find this program code useful, then please deposit 5 Indian Rupees in my bank account, as my fee. (Citizens of Pakistan cannot do this.).
I am the woman who wrote this program code.
My name: Anju K.
My bank account number: 30221619108
Bank: State Bank of India, Chakkarakkal branch, India.
IFSC code: SBIN0070728
SWIFT code: SBININBB
BIC code: SBININBB
My email: tc9749@gmail.com .

MATLAB program for the design and implementation of Butterworth high pass filter

Program code
clc;
clear all;
close all;
fp=input('Please enter the first pass band frequency: ');
fs=input('Please enter the first stop band frequency: ');
rp=input('Please enter the pass band attenuation: ');
rs=input('Please enter the stop band attenuation: ');
sf=input('Please enter the sampling frequency: ');
wp=2*fp/sf;
ws=2*fs/sf;
[n,wn]=buttord(wp,ws,rp,rs);
[b,a]=butter(n,wn,'high');
freqz(b,a);
title('Butterworth High Pass Filter');

Example of output
Please enter the first pass band frequency: 2000
Please enter the first stop band frequency: 1300
Please enter the first pass band attenuation: 0.35
Please enter the first stop band attenuation: 50
Please enter the sampling frequency: 8000


_____________________________

If you find this program code useful, then please deposit 5 Indian Rupees in my bank account, as my fee. (Citizens of Pakistan cannot do this.).
I am the woman who wrote this program code.
My name: Anju K.
My bank account number: 30221619108
Bank: State Bank of India, Chakkarakkal branch, India.
IFSC code: SBIN0070728
SWIFT code: SBININBB
BIC code: SBININBB
My email: tc9749@gmail.com .


MATLAB program for the design and implementation of Butterworth low pass filter

Program code
clc;
clear all;
close all;
fp=input('Please enter the first pass band frequency: ');
fs=input('Please enter the first stop band frequency: ');
rp=input('Please enter the pass band attenuation: ');
rs=input('Please enter the stop band attenuation: ');
sf=input('Please enter the sampling frequency: ');
wp=2*fp/sf;
ws=2*fs/sf;
[n,wn]=buttord(wp,ws,rp,rs);
[b,a]=butter(n,wn,'low');
freqz(b,a);
title('Butterworth Low Pass Filter');

Example of output
Please enter the first pass band frequency: 2000
Please enter the first stop band frequency: 1600
Please enter the pass band attenuation: .5
Please enter the stop band attenuation: 53
Please enter the sampling frequency: 9500


__________________________________

If you find this program code useful, then please deposit 5 Indian Rupees in my bank account, as my fee. (Citizens of Pakistan cannot do this.).
I am the woman who wrote this program code.
My name: Anju K.
My bank account number: 30221619108
Bank: State Bank of India, Chakkarakkal branch, India.
IFSC code: SBIN0070728
SWIFT code: SBININBB
BIC code: SBININBB
My email: tc9749@gmail.com .


MATLAB program for equiripple FIR filter

Program Code
%equiripple FIR filter
clc;
close all;
clear all;
Fs=1000;
Fp=input('Input the pass band frequency Fp= ');
Fst=input('Input the stop band frequency Fst= ');
Ap=input('Input the pass band attenuation Ap= ');
Ast=input('Input the stop band attenuation Ast= ');
d=fdesign.lowpass('Fp,Fst,Ap,Ast');
Hd=design(d,'equiripple');
fvtool(Hd);




Example of Output
Input the pass band frequency Fp= 16000
Input the stop band frequency Fst= 12000
Input the pass band attenuation Ap= 1
Input the stop band attenuation Ast= 50



__________________________________

If you find this program code useful, then please deposit 5 Indian Rupees in my bank account, as my fee. (Citizens of Pakistan cannot do this.).
I am the woman who wrote this program code.
My name: Anju K.
My bank account number: 30221619108
Bank: State Bank of India, Chakkarakkal branch, India.
IFSC code: SBIN0070728
SWIFT code: SBININBB
BIC code: SBININBB
My email: tc9749@gmail.com .



MATLAB program for Ideal Low Pass Linear Phase Fir Filter

Program Code
clc;
close all;
clear all;
wc=input('Input the cut-off frequency in radians(less than pi)');
M=input('Input the length of ideal filter');
if wc>pi
    error('cut-off frequency should be less than pi')
    return
end
alpha=(M-1)/2;
n=0:1:(M-1);
m=n-alpha+eps;
hd=sin(wc*m)./(pi*m);
if nargout==0
    stem(n,hd);
    title('Impulse response of ideal low pass filter');
    xlabel('n');
    ylabel('hd(n)');
end





                      Example of Output
Input the cut-off frequency in radians(less than pi)    3
Input the length of ideal filter     50

ans =

  Columns 1 through 7 

   -0.0123    0.0133   -0.0141    0.0147   -0.0151    0.0152   -0.0149

  Columns 8 through 14 

    0.0143   -0.0134    0.0120   -0.0102    0.0079   -0.0050    0.0016

  Columns 15 through 21 

    0.0025   -0.0075    0.0134   -0.0207    0.0297   -0.0412    0.0569

  Columns 22 through 28 

   -0.0800    0.1194   -0.2074    0.6350    0.6350   -0.2074    0.1194

  Columns 29 through 35 

   -0.0800    0.0569   -0.0412    0.0297   -0.0207    0.0134   -0.0075

  Columns 36 through 42 

    0.0025    0.0016   -0.0050    0.0079   -0.0102    0.0120   -0.0134

  Columns 43 through 49 

    0.0143   -0.0149    0.0152   -0.0151    0.0147   -0.0141    0.0133

  Column 50 


   -0.0123

___________________________

If you find this program code useful, then please deposit 5 Indian Rupees in my bank account, as my fee. (Citizens of Pakistan cannot do this.).
I am the woman who wrote this program code.
My name: Anju K.
My bank account number: 30221619108
Bank: State Bank of India, Chakkarakkal branch, India.
IFSC code: SBIN0070728
SWIFT code: SBININBB
BIC code: SBININBB
My email: tc9749@gmail.com .