What calculation is done to find the gains (k) of the zpk function?
8 views (last 30 days)
Show older comments
State space matrix:
A = [ -0.669951646484827 1.28424762631945e-09 0.011224152177422 -0.137266467613442 0 8.3380759857086e-07;
1 0 0 0 0 0;
-15.5796093146461 -9.77564302835082 -0.0172201697024891 0.0437085492873758 0 -9.43217074987179e-05;
195.456682375095 -0.779222433532193 -0.0745486085894737 -0.730188697017893 0 -0.00127843959431113;
0 -2.89356048753657e-05 0.996838168810935 0.0794585752910095 0 0;
0 -197.035459421598 -0.0794585753231511 0.996838168812305 0 0];
B = [ -36.5034154566994;
0;
3.76413630113738;
-25.9051875864034;
0;
0];
C =[ 1 0 0 0 0 0;
195.456682375095 -0.779222433532193 -0.0745486085894737 -0.730188697017893 0 -0.00127843959431113];
D = [ 0;
-25.9051875864034];
[z,p,k] = ss2zp(A,B,C,D)
z =
Column 1
-0.62671948453317 + 0i
-0.0217530033855665 + 0i
-0.000365798857384335 + 0i
-5.92556062974436e-09 + 0i
5.92549129068837e-09 + 0i
Inf + 0i
Column 2
0 + 0i
-276.100495151319 + 0i
-0.0085919008871075 + 0.0722792555820489i
-0.0085919008871075 - 0.0722792555820489i
-0.00147218583594221 + 0i
-2.50275860753844e-15 + 0i
p =
0 + 0i
-0.696733151596068 + 5.19575335398669i
-0.696733151596068 - 5.19575335398669i
-0.0116313338403144 + 0.0872215466769184i
-0.0116313338403144 - 0.0872215466769184i
-0.000631542332441605 + 0i
k =
-36.5034154566994
-25.9051875864034
How is the calculation done to find the earnings: -36.5034154566994 and -25.9051875864034?
0 Comments
Answers (2)
Star Strider
on 15 Oct 2024
I am not certain that it is documented anywhere (I cannot find it), however it appears to be the coefficient of the highest-order component of the numerator of the transfer function representation.
Example —
A = [ -0.669951646484827 1.28424762631945e-09 0.011224152177422 -0.137266467613442 0 8.3380759857086e-07;
1 0 0 0 0 0;
-15.5796093146461 -9.77564302835082 -0.0172201697024891 0.0437085492873758 0 -9.43217074987179e-05;
195.456682375095 -0.779222433532193 -0.0745486085894737 -0.730188697017893 0 -0.00127843959431113;
0 -2.89356048753657e-05 0.996838168810935 0.0794585752910095 0 0;
0 -197.035459421598 -0.0794585753231511 0.996838168812305 0 0];
B = [ -36.5034154566994;
0;
3.76413630113738;
-25.9051875864034;
0;
0];
C =[ 1 0 0 0 0 0;
195.456682375095 -0.779222433532193 -0.0745486085894737 -0.730188697017893 0 -0.00127843959431113];
D = [ 0;
-25.9051875864034];
[z,p,k] = ss2zp(A,B,C,D)
format shortG
[n,d] = ss2tf(A,B,C,D)
.
4 Comments
Star Strider
on 15 Oct 2024
It is however you calculated it!
We have no idea what you are doing or how you designed that system.
Sam Chak
on 15 Oct 2024
Short Answer:
Due to your specific state-space configuration, k(1) is derived from the first element of the input matrix , while k(2) is derived from the second element of the direct matrix .
format long g
A = [ -0.669951646484827 1.28424762631945e-09 0.011224152177422 -0.137266467613442 0 8.3380759857086e-07;
1 0 0 0 0 0;
-15.5796093146461 -9.77564302835082 -0.0172201697024891 0.0437085492873758 0 -9.43217074987179e-05;
195.456682375095 -0.779222433532193 -0.0745486085894737 -0.730188697017893 0 -0.00127843959431113;
0 -2.89356048753657e-05 0.996838168810935 0.0794585752910095 0 0;
0 -197.035459421598 -0.0794585753231511 0.996838168812305 0 0];
B = [ -36.5034154566994;
0;
3.76413630113738;
-25.9051875864034;
0;
0];
C = [ 1 0 0 0 0 0;
195.456682375095 -0.779222433532193 -0.0745486085894737 -0.730188697017893 0 -0.00127843959431113];
D = [ 0;
-25.9051875864034];
sys = ss(A, B, C, D);
k1 = B(1)
k2 = D(2)
Long Answer:
MATLAB does not show the steps to obtain the solution; it typically provides only the numerical solution in most cases.
The state-space representation must be converted to transfer matrix form using the following formula, which can be found in any Modern Control Theory textbook:
.
In this equation, the transfer matrix relates the number of outputs to the number of inputs . The output matrix indicates that there are two outputs, while the input matrix indicates that there is only one input. Consequently, the transfer matrix will consist of two transfer functions.
The gain vector k obtained from the zpk() command is an array of the coefficients of the highest degree of the numerator in each transfer function.
G = tf(sys)
[num, den] = tfdata(G, 'v')
%% Extract the data from the cell array
k1 = num{1}(2)
k2 = num{2}(1)
7 Comments
Sam Chak
on 16 Oct 2024
Your new query regarding the computation of matrix appears to be unrelated to your original question about how to obtain the gain k, which has been adequately explained above by @Star Strider and me.
Since the technical explanations have been provided, please accept the answer that you find most satisfactory and vote for other helpful responses. You may then continue the discussion in your thread titled "function zpk and linmod," as the "short" answer can be found there.
Accepting answers to questions that have been adequately addressed, rather than leaving their status 'open,' will increase the likelihood of unanswered question receiving favorable responses from other users or experts.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!