Alexandre Torres Porres
Newbie level 1
- Joined
- Aug 23, 2014
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 34
Hi, I'm trying to implement a software and I needed to solve the Z-transform of a single complex pole - it's not about a conjugate pair of complex poles, but a single complex one. A lot of people assume complex poles always exist by pairs, but no, you can filter a signal through a single complex pole.
I'm filtering a real signal with a single complex pole with a complex coefficient (a_re [real part] and a_im [imaginary part]), I also have a gain coefficient but I'm gonna leave it out for the sake of simplicity. The filter has two outputs, one for the real and another for the imaginary part. Here's the filter equation in time for both outputs
real part output: y1[n] = [x1[0] + (a_re * y1[-1]) - (a_im * y2[-1])]
imaginary part output: y2[n] = [(a_im * y1[-1]) + (a_re * y2[-1])]
where "n" is the sample number, x1[0] is the real input, a_re & a_im are, respectively, the real and imaginary part of the coefficient, y1[-1] is the previous output of "real part output" and y2[-1] is the previous output of "imaginary part output".
So, I've already succeeded in dealing with the real version of all this (a real pole), and I'm struggling with the complex version. Anyway, the equation for the real pole is: y[n] = x[0] + a * y[-1] - where "a" is the coefficient of the real pole.
Now, the z transform of the real pole is H(z) = 1 / 1 - a * z^-1, where, again, "a" is the coefficient of the real pole.
In my code I, I'm solving it and dealing with the z-transform in this way, the input of the function is the "a" coefficient and the "w" variable (which is the frequency in radians per sample). I'm only interested in getting the magnitude output, so i don't care about the phase response of the filter. Anyway, here is how I get it:
a = coefficient
w = radians per sample
f_re = cos(w)
f_im = sin(w)
Re = 1 - a * f_re
Im = -a * f_im
Mag = ((Reˆ2) + (Imˆ2))ˆ0.5 // magnitude
H = 1 / Mag
the whole thing would be:
H = 1 / ((1 - a * cos(w)ˆ2) + (-a * sin(w)ˆ2))ˆ0.5
I'm not really sure how this code/formula works cause I copied it from somewhere else, but I'm 100% positive it's working! Now my trouble is adapting it to the complex version of this z transform. All I can find is that is is supposed to be the same formulha
H(z) = 1 / 1 - a * z^-1
But I don't know how to adapt the formula/code for that. Bearing in mind that I want to have the two outputs of the complex filter (the real and imaginary part), I need two frequency responses out of this. So even if I had the actual complex version of the formula/code I'd still be lost on how to separate the real and imaginary part.
By browsing around though, I've found something that may relate to splitting the outputs into real and imaginary. It has to do with multiplying the numerator and denominator by the complex conjugate of the denominator. I think that's the way to go, but I'm not sure at all. Unfortunately my reference is not in english, cause it's the wikipedia in portuguese: Here's the link https://pt.wikipedia.org/wiki/Transformada_Z#Transformadas_das_sucess.C3.B5es_de_senos_e_co-senos
I'm focusing on this formula particularly https://upload.wikimedia.org/math/e/c/a/eca2cfbcb5a1edb8f03bfbaa03722a3a.png
And I'm interpreting the formula would serve the problem like this:
Z{a_re + i*a_im}
real output = z (z-a) / (z-a)ˆ2 + bˆ2
imaginary output = b*z / ((z-a)ˆ2 + bˆ2)
anyway, even if I'm in the right track, I'm not sure how to apply this to any formula/code that I don't really have for the z transform of the complex pole
It all seems so simple in the real version of it, but as you can see I'm pretty lost when it comes to adapting this to the complex version.
any thoughts, considerations, hints, help is highly welcome.
Thanks a lot
I'm filtering a real signal with a single complex pole with a complex coefficient (a_re [real part] and a_im [imaginary part]), I also have a gain coefficient but I'm gonna leave it out for the sake of simplicity. The filter has two outputs, one for the real and another for the imaginary part. Here's the filter equation in time for both outputs
real part output: y1[n] = [x1[0] + (a_re * y1[-1]) - (a_im * y2[-1])]
imaginary part output: y2[n] = [(a_im * y1[-1]) + (a_re * y2[-1])]
where "n" is the sample number, x1[0] is the real input, a_re & a_im are, respectively, the real and imaginary part of the coefficient, y1[-1] is the previous output of "real part output" and y2[-1] is the previous output of "imaginary part output".
So, I've already succeeded in dealing with the real version of all this (a real pole), and I'm struggling with the complex version. Anyway, the equation for the real pole is: y[n] = x[0] + a * y[-1] - where "a" is the coefficient of the real pole.
Now, the z transform of the real pole is H(z) = 1 / 1 - a * z^-1, where, again, "a" is the coefficient of the real pole.
In my code I, I'm solving it and dealing with the z-transform in this way, the input of the function is the "a" coefficient and the "w" variable (which is the frequency in radians per sample). I'm only interested in getting the magnitude output, so i don't care about the phase response of the filter. Anyway, here is how I get it:
a = coefficient
w = radians per sample
f_re = cos(w)
f_im = sin(w)
Re = 1 - a * f_re
Im = -a * f_im
Mag = ((Reˆ2) + (Imˆ2))ˆ0.5 // magnitude
H = 1 / Mag
the whole thing would be:
H = 1 / ((1 - a * cos(w)ˆ2) + (-a * sin(w)ˆ2))ˆ0.5
I'm not really sure how this code/formula works cause I copied it from somewhere else, but I'm 100% positive it's working! Now my trouble is adapting it to the complex version of this z transform. All I can find is that is is supposed to be the same formulha
H(z) = 1 / 1 - a * z^-1
But I don't know how to adapt the formula/code for that. Bearing in mind that I want to have the two outputs of the complex filter (the real and imaginary part), I need two frequency responses out of this. So even if I had the actual complex version of the formula/code I'd still be lost on how to separate the real and imaginary part.
By browsing around though, I've found something that may relate to splitting the outputs into real and imaginary. It has to do with multiplying the numerator and denominator by the complex conjugate of the denominator. I think that's the way to go, but I'm not sure at all. Unfortunately my reference is not in english, cause it's the wikipedia in portuguese: Here's the link https://pt.wikipedia.org/wiki/Transformada_Z#Transformadas_das_sucess.C3.B5es_de_senos_e_co-senos
I'm focusing on this formula particularly https://upload.wikimedia.org/math/e/c/a/eca2cfbcb5a1edb8f03bfbaa03722a3a.png
And I'm interpreting the formula would serve the problem like this:
Z{a_re + i*a_im}
real output = z (z-a) / (z-a)ˆ2 + bˆ2
imaginary output = b*z / ((z-a)ˆ2 + bˆ2)
anyway, even if I'm in the right track, I'm not sure how to apply this to any formula/code that I don't really have for the z transform of the complex pole
It all seems so simple in the real version of it, but as you can see I'm pretty lost when it comes to adapting this to the complex version.
any thoughts, considerations, hints, help is highly welcome.
Thanks a lot