Hi All,
A really stupid question for ya. I appologize in a advance that I am so confused on something this easy.
I am trying to get an FIR lowpass filter to work on some white noise I generated in Audacity. I have already gotten the IIR version of this filter to work using the "butter" command, but I can't seem to get the FIR one to work.
I call in the white noise using "audioread"
[signal,fs] = audioread('white.wav');
Wn = 60/(fs/2); %Cutoff frequency of 60 Hz (normalized)
and then do the following:
%FIR Filter [b_fir,a_fir] = fir1(4,Wn,'high');
signal_fir = filter(b_fir,a_fir,signal);
audiowrite('white_60Hz_fir.wav',signal_fir,fs);
The signal that comes out (signal_fir) doesn't seem to have anything done to it.....
Comments on what I'm doing wrong please.
Thanks in advance

댓글 수: 3

WAJID
WAJID 2014년 8월 24일
i need complete code ..plz send to me
Image Analyst
Image Analyst 2014년 8월 24일
WAJID - that kind of request rarely works. Why don't you read this and then post another question of your own. Reference this post and tell why the answers given here don't work for you. Supply your own data and any background information necessary to let people develop an answer for you.
WAJID
WAJID 2014년 8월 24일
in simulink i enter a white noise to a signal but how to filter it by fir filter?

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

 채택된 답변

Honglei Chen
Honglei Chen 2014년 3월 19일
편집: Honglei Chen 2014년 3월 19일

0 개 추천

Your command
fir1(4,Wn,'high')
designs a highpass instead of a lowpass. Also, for FIRs, I believe fir1 only returns one output, i.e., b_fir. The denominator is always 1 for FIRs, so you could do
filter(b_fir,1,signal)
HTH

댓글 수: 5

Sushma Chandran
Sushma Chandran 2014년 3월 19일
I actually meant to use a high pass so I mis-typed in my message. Thanks for catching that. The fs of my signal is 48000. If I use a fir1(4,Wn,'high') and then filter my signal with the b_fir coefficients nothing seems to happen.
I tried using fir1(48000, Wn,'high') and it seems to work but I don't think I'm using the right input parameter. The first input parameter is supposed to be a filter order, not the number of taps right?
Thanks for your response.
Honglei Chen
Honglei Chen 2014년 3월 20일
You are filtering 60 Hz out of 48 kHz, which is very narrow, so over 85% of band is untackled. I would not expect big change in signal. When you say it's not working, what do you exactly mean?
Sushma Chandran
Sushma Chandran 2014년 3월 25일
What I meant was that the signal appears unchanged when I export it out using the audiowrite command. There's absolutely no filtering occuring. How do I specify the correct number of taps for my FIR filter? The signal bandwidth is about 10 Hz to 16kHz (not 48kHz). I want to filter out everything 60 Hz and below.
Thanks for responding!
Honglei Chen
Honglei Chen 2014년 3월 26일
How strong is your signal below 60Hz and how are you comparing the signals? I wouldn't look at the time waveform for this. I would plot the spectrum as well as the filter's frequency response to make sure it is working as expected.
Sushma Chandran
Sushma Chandran 2014년 3월 31일
Since it's white noise the signal is about the same everywhere. I have attached a picture of what's happening. The first one is a picture of the white noise I am creating in audacity. The second one is after I apply my filter. For these pictures I ended up going with 50 Hz HPF. I think everything is working?

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Statistics and Linear Algebra에 대해 자세히 알아보기

태그

질문:

2014년 3월 19일

댓글:

2014년 8월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by