How to apply an analog signal to a digital FIR bandpass filter?

Status
Not open for further replies.

phoibos323

Newbie level 4
Joined
Feb 21, 2010
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,333
a=input('enter the center frequency of the bandpass filter in hertz.'); %prompt the user to enter the center freq. of the desired bandpass filter.
ntrunc=500; %number of terms for truncation.
n=linspace(-ntrunc/2,ntrunc/2,(ntrunc+1)); %define the coefficients.
ZeroIndex = find( n == 0 ); %find the "0 term".
K=1; %gain=1.
f=[a-5 a+5]; %define lower and upper freq. in Hz.
Fs=5000; %define sampling freq. in Hz.
wl=2.*pi.*(f(1)./Fs); %convert lower freq. to digital freq.
wu=2.*pi.*(f(2)./Fs); %convert lower freq. to digital freq.
wc=[wl wu]; %define passband freq. in pi*rad.
wcpb=(wl+wu)./2; %calculate center of the passband in pi*rad.
wclp=(wu-wl)./2; %calculate lowpass cutoff freq. in pi*rad.
hlp=K./pi./n.*sin(n.*wclp); %define the lowpass filter equation.
hbp=(2.*cos(n.*wcpb)).*hlp; %define the bandpass filter equation.
hbp(ZeroIndex) = wclp ./ 2./pi.*Fs ; %define the value of the "0 term".
freqz(hbp,1,1024); %plot the freq. response of the bandpass filter.

t=linspace(0,pi,1024);
Y=sin(2*pi*697.*t)+sin(2*pi*1477.*t);
c=fft(Y);
m=abs(c);
w=linspace(0,pi,1024);
figure
plot(w,m)


I have a fine working digital FIR bandpass filter - first part of the code- but I need to apply the DTMF signal to the filter and detect the frequency of the signal. I'm having a hard time to apply this signal to the filter. Is it possible to simply convolve these two equations or do I need to find the absolute value of the input signal in frequency spectrum then convolve it. urgent help is needed.

Thank you in advance...

Kutlu,
Electrical and Electronics Engineering student ( senior year )
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…