In fir1 one argument is Wn. I can't understand how its possible to create filter without specify the real frequency? For example, if I try to run low-pass fir filter with Wn=0.5 on two signals, one with Fs=1000 and one with Fs=10,000 how the filter can "know" what frequency is Wn=0.5 to perfom the low-pass filtering on each signal? thank you

답변 (1개)

Star Strider
Star Strider 2017년 1월 15일

4 개 추천

The ‘Wn’ argument expresses the normalised frequencies for the passbands and stopbands. That means that for a discrete filter, these are already on the interval (0,pi), where pi is defined as the Nyquist frequency (half the sampling frequency). So that information is inherent in the ‘Wn’ argument, even if not explicitly stated.
If you use a window function (such as I did here in a code snippet from another Answer):
fcuts = [0.08 0.19]; % Frequency Vector
mags = [1 0]; % Magnitude (Defines Passbands & Stopbands)
devs = [0.01 0.05]; % Allowable Deviations
[n,Wn,beta,ftype] = kaiserord(fcuts,mags,devs,Fs); % Kaiser Window
n = n + rem(n,2);
hh = fir1(n,Wn,ftype,kaiser(n+1,beta),'scale'); % Design FIR Lowpass Filter
the window function incorporates the sampling information (in ‘Fs’, the last argument to kaiserord here) and then presents fir1 with the normalised passbands and stopbands.

댓글 수: 4

nadav potasman
nadav potasman 2017년 1월 15일
Thank you for your answer. So you say that I can use the same filter for different signals with different `Fs` and its work on them the same (from normelized frequency perspective)?
Star Strider
Star Strider 2017년 1월 15일
My pleasure.
Yes. You can use the same filter with different values for ‘Fs’, but the passbands and stopbands will change with the value of ‘Fs’ changes.
For example, if you have a lowpass filter with a stopband of 0.5*pi radians, with a sampling frequency of 1000 Hz, the stopband will be 250 Hz (since Fn = 500) where ‘Fn’ is the Nyquist frequency. For a sampling frequency of 44100 Hz, the stopband for the same filter will be 11025 Hz.
nadav potasman
nadav potasman 2017년 1월 15일
Thank you very much again!
Star Strider
Star Strider 2017년 1월 15일
My pleasure!
If my Answer helped you solve your problem, please Accept it!

댓글을 달려면 로그인하십시오.

카테고리

태그

질문:

2017년 1월 15일

댓글:

2017년 1월 15일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by