acker(): "Error using sym/poly". Why?
古いコメントを表示
I'm trying to find the eigenvalues of a matrix H manually, where H represents some system dynamics.
(The system is defined by H, so eigs are solutions to det(H-lamba*I) = 0)
Once i find those eigs, i input them to acker() for pole placement to find gains.
(1) Why am i getting an error when inputting what i think are a set of normal numbers to acker()? See code below.
Note: I compare this to the normal eig(H) results to see if it's working, so i can see the normal method works with acker().
(2) Why is vpa() needed, ie why is solve() returning functions of z? I thought solve() would return numbers, since it's just trying to find solutions to det(H-lamba*I) = 0), which evaluates to:
lam^6 - 15999360000*lam^4 + 16000160000000000*lam^2 - 160000000000000000000000 == 0
and that seems like returned solutions should be just normal complex numbers.
A = [0 1;
-4e5 -400];
B = [0; 4e5];
C = [1 0];
Aaug = [A, zeros(2,1); -C, 0];
Baug = [B; 0];
H = 1.0e+12 * [0 0.000000000001000 0 0 0 0;
-0.000000400000000 -0.000000000400000 0 0 -0.160000000000000 0;
-0.000000000001000 0 0 0 0 0;
-0.000000100000000 0 0 0 0.000000400000000 0.000000000001000;
0 -0.000000000000100 0 -0.000000000001000 0.000000000400000 0;
0 0 -1.000000000000000 0 0 0];
% ~~~~~~~ Built-in eigs ~~~~~~~
% These are a set of numbers
eigs1 = eig(H)
whichNegEig = find(real(eigs1)<0);
K = acker(Aaug, Baug, eigs1(whichNegEig))
% ~~~~~~~ Manually find eigs ~~~~~~~
syms lam;
sysDet = det(H - lam*eye(size(H)));
polySys = solve(sysDet == 0, lam)
eigs2= vpa(polySys)
% These SHOULD be a set of numbers. Are they not?
whichNegEig2 = find(real(eigs2)<0);
% They SEEM the same as whichNegEig, so seem correct.
eigs2(whichNegEig2)
% Why is this giving this error:
% "Error using sym/poly
% SYM/POLY has been removed. Use CHARPOLY instead."
K2 = acker(Aaug, Baug, eigs2(whichNegEig2))
4 件のコメント
John
2023 年 7 月 15 日
Star Strider
2023 年 7 月 15 日
The Symbolic Math Toolbox (SMT) calculations are always all symbolic, not numeric in the sense that they can be used outside the SMT . The vpa function converts the fractional representation (including ‘root’) into their numeric equaivalents, however they remain symbolic variables. So the vpa call is not absolutely necessary, however double is, because it converts the symbolic results to numeric results that can be used elsewhere in MATLAB calculations..
.
John
2023 年 7 月 15 日
My pleasure!
Example —
x = 1
whos x
syms x
y = x
whos y
The sympref call:
sympref('FloatingPointOutput',true);
produces floating-point representation with four digits after the decimal, instead of producing fractional constants. It does not automatically invoke vpa. See Display Symbolic Results in Floating-Point Format for a full explanation.
.
採用された回答
その他の回答 (1 件)
Walter Roberson
2023 年 7 月 15 日
1 投票
acker() is a now-undocumented function in the Control Systems Toolbox, in a directory reserved for "obsolete" functions. In other words, it was withdrawn and should not be used in any new code.
カテゴリ
ヘルプ センター および File Exchange で Common Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





