MATLAB Answers

Low pass filter design

조회 수: 71(최근 30일)
Tejas
Tejas 14 Feb 2011
I need to design a low pass filter with a cutoff frequency of 50Hz. I am using the sptool in MATLAB to design the filter. How does the sampling frequency of the filter and the sampling frequency of the input signal to the filter affect the output response of the filter?Can somebody please help me with the specifications that should be applied to the filter so that the output waveform is optimum? There are many filters available and I do not have sufficient background to design.

  댓글 수: 0

Sign in to comment.

답변(3개)

Jan Rubak
Jan Rubak 14 Feb 2011
Filter design is all about tradeoffs, so you need to choose the design method that best suits your needs. If this is for a student project, chances are that the nuanced differences between the various design methods do not really have great import for you (although linear phase in the passband is often an important requirement), and a good starting point would be an equiripple FIR filter where you specify the length, cutoff frequency, passband ripple and stopband attenuation.
The length of your filter should reflect your how stationary the input signal is, in general should be much less than the length of your time-series and preferably more than one cycle at the cut-off frequency (for 50Hz cutoff at 1000Hz sample rate, you're probably looking at something between N = 50 and 250).
Reasonable starting points for passband ripple and stopband attenuation are, say, 1dB and 60dB, respectively. But this is really something that you'd typically choose based on the characteristics of your data: what you consider signal, what you consider noise, how strong they tend to be relative to each other.
Try this:
FilterSpec = fdesign.lowpass('N,Fc,Ap,Ast',50,50,1,60,1000); % Or use the 'N,Fp,Ap,Ast' format if that's more applicable
disp(designmethods(FilterSpec)) % To verify that this specification is appropriate for the type of design method you want to use
FilterObj = design(FilterSpec,'equiripple');
fvtool(FilterObj) % To visually explore the spectral characteristics of your filter
If the transition band isn't narrow enough for your needs, then you can increase the length of the the filter, or relax the passband ripple or stopband attenuation constraints.
Once you're happy with your design, you can apply the filter to your time-series via any of:
FilteredSeries = FilterObj.filter(RawTimeSeries);
FilteredSeries = filter(FilterObj,RawTimeSeries);
FilteredSeries = filter(FilterObj.Numerator,1,RawTimeSeries);
FilteredSeries = conv(RawTimeSeries,FilterObj.Numerator,'valid');
The 3rd and 4th of these only work for FIR filters. You'll probably want to discard the first N values of the filtered series generated by the first three commands (the fourth command already does this because of the 'valid' flag).
For more information, the standard textbook (though I'm not a huge fan) is "Discrete-Time Signal Processing" by Oppenheim & Schafer. This also looks like a good learning resource (see Chapter 14), and maybe this one too.

  댓글 수: 0

Sign in to comment.


Rafael
Rafael 27 Jun 2011
Thank you very much. It was really useful!

  댓글 수: 1

Jan Rubak
Jan Rubak 28 Jul 2011
Glad to hear it! -J

Sign in to comment.


Mahesh Hegde
Mahesh Hegde 9 Mar 2012
that was nice explantion

  댓글 수: 0

Sign in to comment.


Translated by