Hello can someone help me, what am I doing wrong in writing this expression into MATLAB. How do I make the z's negative? Here is my code:
Nd=[-8 5 4 0 -1 -3 2];
Dd=[-0.0648 -0.1134 0.6184 -1.436 1.7 -1.6 1]; P=Nd;Q=Dd; H = tf(P,Q,0.1)
Here is the result I'm getting:
H =
8 z^6 - 5 z^5 - 4 z^4 + z^2 + 3 z - 2
----------------------------------------------------------------------
0.0648 z^6 + 0.1134 z^5 - 0.6184 z^4 + 1.436 z^3 - 1.7 z^2 + 1.6 z - 1
And here is the expression I want to enter:
$$ H(z)=\frac{2-3z^{-1}-z^{-2}+4z^{-4}+5z^{-5}-8z^{-6}}{1-1.6z^{-1}+1.7z^{-2}-1.436z^{-3}+0.6184z^{-4}-0.1134z^{-5}-0.0648z^{-6}} $$
I think you need to mirror the coefficient vectors and formulate in z^-1
:
Nd = [2, -3, -1, 0, 4, 5, -8];
Dd = [1, -1.6, 1.7, -1.4362, 0.6184, -0.1134, -0.0648];
H = tf(P, Q, 0.1, 'Variable', 'z^-1')
Then you get:
H =
2 - 3 z^-1 - z^-2 + 4 z^-4 + 5 z^-5 - 8 z^-6
------------------------------------------------------------------------------
1 - 1.6 z^-1 + 1.7 z^-2 - 1.4362 z^-3 + 0.6184 z^-4 - 0.1134 z^-5 - 0.0648 z^-6