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 commentaires

Walter Roberson
Walter Roberson le 25 Juin 2012
What problem? Is the code producing an error message, or is the result not matching your expectation?
Is there a reason that you carefully compute z=a+b+c and then throw away the value for z by assigning to z in the statement [z,a]=butter(3,90/100) ?
amir
amir le 26 Juin 2012
there are no problem in my script
but the result not expectation
can you help me ?
I want pass the 900Hz and rejected another signal or frequence
Is there another solution?
Walter Roberson
Walter Roberson le 26 Juin 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.
amir
amir le 26 Juin 2012
suppose that if we get back on first question, with a different frequency signal we want to separate one
What is your solution?
The band-pass filter can be used?
Can you write script fot me ?
thanks for your help!!!

Connectez-vous pour commenter.

 Réponse acceptée

Wayne King
Wayne King le 26 Juin 2012

0 votes

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.

Plus de réponses (0)

Catégories

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by