Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

butter and buttord functions

Status
Not open for further replies.

memeth

Newbie level 5
Newbie level 5
Joined
Apr 17, 2010
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Milano, Italy
Activity points
1,348
Hi all,

i have a signal vector with length=15612. With a FFT using N=2^14=16384 points i obtained spectrum of the signal. Now, i need to create a low-pass filter and a band-pass filter. I decided to use butter function but to obtain N and Wn values i need to use buttord function. But i don't understand what Wp, Ws, Rp and Rs are. I have no experience in signal processing. Can you please help me? I have already read the definitions of Wp, Ws, Rp and Rs but i don't understand anything. How can i decide on them?

Thank you
 

when you type "help buttord" in matlab you get:

BUTTORD Butterworth filter order selection.
[N, Wn] = BUTTORD(Wp, Ws, Rp, Rs) returns the order N of the lowest
order digital Butterworth filter that loses no more than Rp dB in
the passband and has at least Rs dB of attenuation in the stopband.
Wp and Ws are the passband and stopband edge frequencies, normalized
from 0 to 1 (where 1 corresponds to pi radians/sample). For example,
Lowpass: Wp = .1, Ws = .2
Highpass: Wp = .2, Ws = .1
Bandpass: Wp = [.2 .7], Ws = [.1 .8]
Bandstop: Wp = [.1 .8], Ws = [.2 .7]
BUTTORD also returns Wn, the Butterworth natural frequency (or,
the "3 dB frequency") to use with BUTTER to achieve the specifications.

[N, Wn] = BUTTORD(Wp, Ws, Rp, Rs, 's') does the computation for an
analog filter, in which case Wp and Ws are in radians/second.

When Rp is chosen as 3 dB, the Wn in BUTTER is equal to Wp in BUTTORD.
 

Thank you JoannesPaulus but actually matlab help doesn't help me much in understanding. How can i get information about all these?
 

Wp (defined as fp/(2*fs), fs is the sampling frequency) is the normalized frequency at which you set a max attenuation in the passband, no more than Rp. In the same way, Ws is the normalized frequency at which you set a min attenuation in the stopband, Rs. Wn is the normalized 3dB frequency.
 

Thank you very much,

As far as i understood, Wp is the normalized frequency value below which we want to keep the signal, Ws is the normalized frequency value after which signal will be attenuated. Am i right?

What about the Rp and Rs values? Which values do you suggest?
 

memeth said:
What about the Rp and Rs values? Which values do you suggest?
It really depends on your application. How much are you allowed to attenuate the signal in the passband? How much do you need to attenuate your signal in the stopband? These numbers affect the complexity of the filter.
If you are just playing with them to learn about filters, start for instance with Rp=0.5 and Rs=20 and then increase or decrease them as you see fit.
 

    memeth

    Points: 2
    Helpful Answer Positive Rating
hi,

i will play with those numbers and try to get a good result but, i am a little bit confused about Wp and Ws values

For a low-pass filter, does the Wp value define the frequency level below which the frequency components will be kept? and does the Ws value define the freq. level above which the frequency components will be attenuated? And i am not sure but there should be a transition between these 2 bands, defined by Rp and Rs values...

and for a band-pass filter, i am completely lost ! i guess below Ws(1) value and above Ws(2) value the signal will be attenuated. and i think between Wp(1) and Wp(2) values the freq. components will be kept. But i am almost going mad about all these :( i don't understand exactly.

and how much distance is required between Ws and Wp values? i think it depends on Rp and Rs values ... or not? please help me :) arggghhh !
 

I dont think theres a absolute right answer for your question. Usually when i have this type of problem i just try different values until i get a result im happy with.

The transition band in a low pass filter is the difference between Wp and Ws. Having a short transition band means you cut the signal more sharply but in return you need a higher N which makes the computation more intensive. Essentially you look at your signal and find the last frequency you want to keep fully and then find the stuff that absolutely has no place in your filtered signal, the frequency band between these two points is your transition band. Different filter types also do different aspects of filtering well. If you looking for a steep transition you might consider using the elliptic filter. If im unsure of what im doing i usually use a 500 Hz transition and then go from there

One way to check how well your filtering went is to draw a spectrogram. If the signal didnt filter properly just refine your parameters.
 

    memeth

    Points: 2
    Helpful Answer Positive Rating
Just one minor remark to Mathuranathan's article: Wp (=2*pi*Fp) corresponds to the passband frequency if and only if Rp=3dB. If not, the passband is somewhat higher, between Fp and Fs.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top