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.

Why bandpass code not working

Status
Not open for further replies.

bcha

Newbie level 3
Joined
Apr 9, 2012
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,305
fs=4000; %half the sampling freq qhich is used for normalising
wp=[3150 3700]/fs
wp=wp*2*pi
ws=[3140 3710]/fs %mychosen values
ws=ws*2*pi
[n16 wn16]=buttord(wp,ws,0.1,40);%my chosen rp and rs
[z16,p16,k16]=butter(n16,wn16,'bandpass')


i know its coz wp and ws are not between 0 and 1 but how do i choose an appropriate fs inorder to achieve that.
 

albbg

Advanced Member level 4
Joined
Nov 7, 2009
Messages
1,254
Helped
434
Reputation
868
Reaction score
389
Trophy points
1,363
Location
Italy
Activity points
9,478
As you said, wp and ws are the frequencies normalized to half sampling rate frequency, then 1 means half sampling frequency.

Thus if fs=4000, [3150 3700] and [3140 3710] are in homogeneous measurement units, I mean all of them "Hz" or all of them "rad/sec" then you have to simply divide:

wp=[3150 3700]/fs --> [0.7875 0.925]
ws=[3140 3710]/fs --> [0.785 0.9275]

you don't have to multiply by 2*pi.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top