Forums

digital filtering problem

Started by xijingzh January 5, 2006
Please help me, I have been struck here for a long time.

Here is my problem

I have a real signal in the time domain.I need to remove a band of
frequency from it to get a new real signal. So first I FFT this
input real signal and multiply the FFT ouput by a filter function I
chose from matlab. I hope I can get a new power spectrum with that
designated band of frequency zero. But I tried many ways, I can not
get it successfully.Below is my matlab file:

% the original pulse input
t=0.3721124:0.3721124:0.3721124*160;
wQ*1034.631154/1000000;
x=0.0082*cos(-t*w);
plot(x(1:160))
title('singnal quarter of cosine')
xlabel('timestep')

% I want to remove the low frequency band from 0.05-0.07, my
sampling interval is about 0.372114

ff = [0 0.04*0.37 0.05*0.37 0.07*0.37 0.08*0.37 1];
aa = [1 1 0 0 1 1];
nn = 160;
bb = firls(nn,ff,aa);
[h,w] = freqz(bb);
plot(ff,aa,w/pi,abs(h))
legend('Ideal','firls Design')

Xt(x);
Xh = filter(bb,1,X);
% fft to get the whole frequency content
f=1/0.3721124/160*(0:20);
Pxx=Xh.* conj(Xh)/160
We=exp(-10*log(10));
Ub=log10((Pxx)+We);
plot(f,Ub(1:21))
title('frequency content')
xlabel('frequency')