butter filter
21 views (last 30 days)
Show older comments
hi
suppose there are three signal like this
syms t x
a=2*sin(2*pi*t*300)
b=2*sin(2*pi*t*600)
c=2*sin(2*pi*t*900)
i I'll pass the frequency of 900 with butter filter
and my script is
syms t x
a=2*sin(2*pi*t*300)
b=2*sin(2*pi*t*600)
c=2*sin(2*pi*t*900)
z=a+b+c
[z,a]=butter(3,90/100)
fvtool(z,a)
where is the problem ?
please help
4 Comments
Walter Roberson
on 26 Jun 2012
Since you are overwriting "z" in your assignment of the output of butter(), you might as well not calculate the initial "z". The initial "z" is formed from the variables "a", "b", and "c", and those variables are not used after that point (the "a" that appears later is the "a" that is output from butter()), so you might as well not calculate them either. This reduces your script to
[z,a]=butter(3,90/100)
fvtool(z,a)
Are you sure that is correct and sufficient ??
If you want to pass 900 Hz and reject other frequencies, then you need a very narrow band-pass filter. The syntax you have used for butter() is not correct for creating a band-pass filter.
Accepted Answer
Wayne King
on 26 Jun 2012
If you want to pass 900 Hz and reject the other frequencies, you need a highpass filter. You have designed a lowpass filter. Why are you using symbolic variables? And we need to know your sampling frequency in order to design a useful filter.
In this example, I'll assume that the sampling rate is 10 kHz.
Fs = 1e4;
[b,a] = butter(15,(2*650)/1e4,'high');
t = 0:1/Fs:1;
x = 2*sin(2*pi*t'*[300 600 900]);
x = sum(x,2);
% view your filter's magnitude response
fvtool(b,a,'Fs',Fs);
% filter the data
output = filter(b,a,x);
Although with such a stringent filtering problem, I think you're better off using fdesign.highpass.
d = fdesign.highpass('Fst,Fp,Ast,Ap',650,700,80,0.5,Fs);
Hd = design(d,'butter');
output = filter(Hd,x);
I think you see the above filter removes all but the 900 Hz component.
More Answers (0)
See Also
Categories
Find more on Digital Filter Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!