Showing posts with label ideal low pass linear phase fir filter. Show all posts
Showing posts with label ideal low pass linear phase fir filter. Show all posts

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 .