I have a z transform in rational form as shown in attached photo
and i want to convert it into factored form
How can i implement it in MATLAB? I learnt from a google resource that we should use "zp2sos"command but i am not satisfied because output of "zp2sos"command does not looks like factored form
By the way, you do not need to create an zpk intermediate form
z = tf('z');
H = (4*z^2+3*z+9)/(4*z^2+3*z-4)
H =
4 z^2 + 3 z + 9
---------------
4 z^2 + 3 z - 4
Sample time: unspecified
Discrete-time transfer function.
H = [H, z/H] %just to give a more complicated system
H =
From input 1 to output:
4 z^2 + 3 z + 9
---------------
4 z^2 + 3 z - 4
From input 2 to output:
4 z^3 + 3 z^2 - 4 z
-------------------
4 z^2 + 3 z + 9
Sample time: unspecified
Discrete-time transfer function.
HN = H.Numerator;
HD = H.Denominator;
HN = cellfun(@(C) C(find(C,1):end), HN, 'uniform', 0); %trim leading 0
HD = cellfun(@(C) C(find(C,1):end), HD, 'uniform', 0); %trim leading 0
From my understanding of the question, you want to convert the unfactored Z-transform representation into its factored form. Here is how it can be achieved using MATLAB’s Symbolic Math Toolbox:
b = [4 3 9]; % Numerator coefficient
a = [4 3 -4]; % Denominator coefficient
[zeros,poles,gain] = tf2zp(b,a) % Convert the TF to pole-zero-gain form
zeros =
-0.3750 + 1.4524i
-0.3750 - 1.4524i
poles = 2×1
-1.4430
0.6930
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
gain = 1
syms z % Symbolic variable z
num = gain * prod(z - zeros) % Numerator of factored form
num =
den = prod(z - poles) % Denominator of factored form
den =
factoredForm = num/den % TF in factored form
factoredForm =
For more information on the Symbolic Math Toolbox and its capabilities, please refer to the MATLAB documentation:
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.