Error in acker function, poles do not much size A?

18 views (last 30 days)
I am trying to use the ACKER function in my code but i keep getting an error and not sure why. The syntax seems to be correct so I am not sure what is wrong with it. I seems to start with the function on line 26 but refers to the error being in line 31?
clc;
close all;
s = tf("s");
Mg = 5.7; Ms = 6.7; Jm = 10.91e-3;
r = 31.75e-3;
b = 0.268;
Km = 0.8379; Kb = 0.838; Ra = 1.36; La = 3.5e-3;
JT = Jm + (r^2)*(Mg+Ms);
Gload = 1/((JT*s+b));
Garm = Km/(La*s+Ra);
G = feedback(Gload*Garm, Kb);
G_dcmotor = minreal(G/s);
%requirements
Mp = 2/100;
Ts = 100e-3;
zeta = -log(Mp)/sqrt(pi^2+(log(Mp))^2);
wn = 4/(zeta*Ts);
wd = wn * sqrt(1-zeta^2);
poles = (-zeta*wn+1i*wd-zeta*wn-1i*wd-100*zeta*wn);
% Required Gain Matrix
[num,den] = tfdata(G_dcmotor);
[A,B,C,D] = tf2ss(num{1},den{1});
Gain = acker(A,B,poles); % this is where it says the error is.
%New State Matrix
A_new = A-B*Gain; % error refers back to this line and says pole do not match size (A)?
B_new = B;
C_new = C;
D_new = 0;
sys = ss(A_new, B_new, C-new, D_new);
dc_gain = dcgain(sys);
N = 1/(dc_gain); % Scaling Factor
sys_mod = ss(A_new, N*B_new, C_new, D_new);
step(sys_mod);
stepinfo(sys_mod);

Answers (1)

Paul
Paul on 27 Apr 2021
poles should have three elements based on the size of A, but it only has one:
>> poles
poles =
-4.0800e+03

Categories

Find more on Programming in Help Center and File Exchange

Tags

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!