Problem using variable='z^-1' in Z transform with Z^-1 format
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi Dears ,
What is the difference between one step and two step to define the 'variable'='z^-1'?
I want Z transform function 1/z^3 in term of z^-1 and the two step is ok not one step.
See the Matlab doc for tf, section: "Specify Polynomial Ordering in Discrete-Time Transfer Function"
num=[1];
den=[1 0 0 0];
% Two step is OK!
X1=tf(num,den,0.1)
X1.Variable='z^-1'
% One step is not OK!
X2=tf(num,den,0.1,'variable','z^-1')
X1 not equal X2
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1140825/image.jpeg)
0 commentaires
Réponses (2)
Walter Roberson
le 30 Sep 2022
Setting the Variable property afterwards just changes the Variable property, without reinterpretting the matrices. It is not a conversion operation, it is just rewriting the label.
0 commentaires
Paul
le 15 Déc 2024
When specifying a tf in with Variable='z', the num and den are interpreted as being coefficients of descending powers of z
num=[1];
den=[1 0 0 0];
With default Variable = 'z' those mean
num(z) = 1*z^0
den(z) = 1*z^3 + 0*z^2 + 0*z^1 + 0*z^0
% Two step is OK!
X1=tf(num,den,0.1)
Now, when we switch the Variable,
X1.Variable='z^-1'
the num and den are converted to be coefficients of ascending powers of z^-1
X1.num{1} % 0*(z^-1)^0 + 0*(z^-1)^1 + 0*(z^-1)^2 + 1*(z^-1)^3 = z^-3
X1.den{1} % 1*(z^-1)^0 + 0*(z^-1)^1 + 0*(z^-1)^2 + 0*(z^-1)^3 = 1
If we specify Variable = 'z^-1' from the outset in one step, we have to define num and den in ascending powers of z^-1
% One step is not OK!
%X2=tf(num,den,0.1,'variable','z^-1')
X2 = tf([0 0 0 1],1,0.1,'Variable','z^-1')
X1 - X2 % verify
2 commentaires
Walter Roberson
le 16 Déc 2024
When the '^-1' variables are specified in the tf() call, the coefficients are stored internally in the reverse order. Meanwhile, setting the variable after the tf() is established changes the variable but does not alter the order of coefficients. So if you change the variable to z^(-1) after it defaulted to s, then the coefficients come out backwards because they are not automatically reversed when you set the variable after the tf() call.
Paul
le 16 Déc 2024
Upon reflection, I agree with the first part of your comment because upon construction the num or den are appropriately zero padded so that numel(H.num{1}) == numel(H.den{1}). With that zero padding the coefficients are the same whether they be in terms of z or z^-1. I should have (and used to) know this. At construction we do have to keep in mind the difference between coefficients in descending powers of z and ascending powers of z^-1.
However, I'm not sure what you mean by the second part of your comment. Changing the variable from z^-1 to s results in an error
num = [0 1 3]; den = [1 2];
H = tf(num,den,-1,'Variable','z^-1')
H.Variable = 's'
Voir également
Catégories
En savoir plus sur Digital Filtering dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!