Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Filtering of audio signal

Subject: Filtering of audio signal

From: Djordje

Date: 27 Dec, 2013 10:32:10

Message: 1 of 2

Hello everybody,

I have some question, think you can help.
I have this code that I use for filtering some audio samples. I did it well in older versions of Matlab, but in the new versions I have this error message:

Error using buttord (line 64)
The cutoff frequencies must be within the interval of (0,1).

I tried everything but unsuccessfuly...The code is:

Ts=1/Fs;
fp=f1/2-500;
wp=2*pi*fp;
fs=f1-1300;
ws=2*pi*fs;
rp=1;
rs=90;

[N, wn] = buttord(wp, ws, rp, rs);
[bnum, bden] = butter(N, wn);
[numd, dend] = impinvar(bnum, bden, 1/Ts);

f1 and f2 are the frequencies from audio signal. And once again, it did well in older version of Matlab, but in new one (2012) I get this error...

Subject: Filtering of audio signal

From: Nasser M. Abbasi

Date: 27 Dec, 2013 12:33:34

Message: 2 of 2

On 12/27/2013 4:32 AM, Djordje wrote:
> Hello everybody,
>
> I have some question, think you can help.
> I have this code that I use for filtering some audio samples. I did it
>well in older versions of Matlab, but in the new versions I have this error message:
>
> Error using buttord (line 64)
> The cutoff frequencies must be within the interval of (0,1).
>
> I tried everything but unsuccessfuly...The code is:
>
> Ts=1/Fs;
> fp=f1/2-500;
> wp=2*pi*fp;
> fs=f1-1300;
> ws=2*pi*fs;
> rp=1;
> rs=90;
>
> [N, wn] = buttord(wp, ws, rp, rs);
> [bnum, bden] = butter(N, wn);
> [numd, dend] = impinvar(bnum, bden, 1/Ts);
>
> f1 and f2 are the frequencies from audio signal. And once again, it did well in
>older version of Matlab, but in new one (2012) I get this error...
>

Try doing it this way:

wp=2*pi*fp/Fs;
ws=2*pi*fs/Fs;

Where fp is the passband freq in Hz, and fs is stopband
in Hz, and Fs is Sampling frequency in Hz.

You did not give what values you used for your f1 and Fs and so one
can't help you more. cut-off frequencies has to be in 0,1
range offocurse.

--Nasser

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us