DSPRelated.com
Forums

Newbie in matlab..need help urgently!

Started by Unknown March 12, 2006
I am trying to implement a bandpass filter on a signal data, xx. It is
of 200,000 samples and the sampling frequency is 40 kHz.

I am using a butter filter function and my program is as followed:

HalfFs = Fs/2
Wp = [1000 1550]/HalfFs; Ws = [950 1600]/HalfFs;
Rp = 3; Rs = 40;

%Calculate the minimum order of Butterworth filter
[n,Wn] = buttord(Wp,Ws,Rp,Rs)

[b,a] = butter(n,Wn);

yy - filter (b,a,xx);
xx = conv(xx,yy);

my program always hang upon the convolution step...does anybody knows
how to solve this problem?

Your MATLAB program looks OK (except for the typographical error in the
next to last statement, where "yy - filter(..." must be "yy =
filter(...)) until the final statement "xx = conv(xx,yy);", which:
  1. is not needed!  The statement "yy = filter(b, a, xx)" produces the
desired answer, the result of filtering the input data, xx, with the
butterworth filter (which is described by the coefficient vectors b and
a).  There is no need to call conv() at all.
  2. will indeed take a rather long time to compute, since it requires
4e10 multiplies and adds!

cheers,
  jerry