Erupter
06-29-2008, 10:59 AM
Hallo.
I've found this old topic (http://www.devmaster.net/forums/showthread.php?t=7120) and gathered some info about IIR.
I am somewhat familiar with signal theory concepts (convolution, time and frequency domains) as well as with bode, poles and zeros, nyquist.
Now i lack all about digital filters.
I understood the Z transform from what has been said in that topic mentioned above, but when i go and apply it i get totally different results in matlab.
For example i designed this filter
for i=1:k
for j=1:l
if((i-j-1) > 0)
output_vector(1,i)=output_vector(1,i) + (a_vector(1,j)*input_vector(1,i-j-1)) - (b_vector(1,j)*output_vector(1,i-j-1));
end
end
end
which should implement an IIR given an input data vector, and two coefficient vectors.
Now if i create the coefficient with
[b,a]=butter(order, wn, 'low');
(i suppose you are familiar with this)
i get an hi-pass instead of a low pass when i put the coeffs in my filter!
I can't begin to understand why.
Also i take that a thing such as this
Y_0 = alpha Y_-1 + (1-alpha) X_0
is a low pass, and it indeed works, but can i get back to a fomulation like
Y/X = 1 / (1 + jw beta)
where beta is somewhat derived from alpha?
Theoretically i've understood the basics, but the fact that in matlab i cannot get predictable behaviour is frustraing to say the least!
I hope you can help me.
I've found this old topic (http://www.devmaster.net/forums/showthread.php?t=7120) and gathered some info about IIR.
I am somewhat familiar with signal theory concepts (convolution, time and frequency domains) as well as with bode, poles and zeros, nyquist.
Now i lack all about digital filters.
I understood the Z transform from what has been said in that topic mentioned above, but when i go and apply it i get totally different results in matlab.
For example i designed this filter
for i=1:k
for j=1:l
if((i-j-1) > 0)
output_vector(1,i)=output_vector(1,i) + (a_vector(1,j)*input_vector(1,i-j-1)) - (b_vector(1,j)*output_vector(1,i-j-1));
end
end
end
which should implement an IIR given an input data vector, and two coefficient vectors.
Now if i create the coefficient with
[b,a]=butter(order, wn, 'low');
(i suppose you are familiar with this)
i get an hi-pass instead of a low pass when i put the coeffs in my filter!
I can't begin to understand why.
Also i take that a thing such as this
Y_0 = alpha Y_-1 + (1-alpha) X_0
is a low pass, and it indeed works, but can i get back to a fomulation like
Y/X = 1 / (1 + jw beta)
where beta is somewhat derived from alpha?
Theoretically i've understood the basics, but the fact that in matlab i cannot get predictable behaviour is frustraing to say the least!
I hope you can help me.