This question determine the static error constants, 𝐾𝑝, 𝐾𝑣, and 𝐾𝑎 of all the open-loop systems below and then determine the system types. But i keep getting an error.
119 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
and below is the MATLAB i wrote.
a = [1,12];
b = [1,15,54];
rt = tf(a,b);
syms s; % Symbolic variable
num = a;
den = poly2sym(b,s);
gs = num/den; % Symbolic representation of OLTF
Kp = lim(gs); % Position constant, Kp
Kv = lim(s*gs); % Velocity constant, Kv
Ka = lim(s^2*gs); % Acceleration constant, Ka
fprintf('\nc) Determine the static error constants:\n\t\t Kp = %.3f,\n\t\t Kv = %.3f,\n\t\t Ka = %.3f\n', Kp, Kv, Ka)
checkSystemType(Kp,Kv,Ka);
disp (' ') % New line
%% User-defined functions
function y = lim(f)
syms s;
y = limit(f,s,0);
if isnan(y)
y = inf;
end
end
function checkSystemType(Kp,Kv,Ka)
if ~isinf(Kp) && Kv == 0 && Ka == 0
disp('System type: 0');
elseif isinf(Kp) && ~isinf(Kv) && Ka == 0
disp('System type: 1');
elseif isinf(Kp) && isinf(Kv) && ~isinf(Ka)
disp('System type: 2');
end
end
Respuestas (1)
Walter Roberson
el 6 de Oct. de 2021
You missed that a represents a polynomial.
a = [1,12];
b = [1,15,54];
rt = tf(a,b);
syms s; % Symbolic variable
num = poly2sym(a, s)
den = poly2sym(b,s)
gs = num/den % Symbolic representation of OLTF
Kp = lim(gs) % Position constant, Kp
Kv = lim(s*gs) % Velocity constant, Kv
Ka = lim(s^2*gs) % Acceleration constant, Ka
fprintf('\nc) Determine the static error constants:\n\t\t Kp = %.3f,\n\t\t Kv = %.3f,\n\t\t Ka = %.3f\n', Kp, Kv, Ka)
checkSystemType(Kp,Kv,Ka);
disp (' ') % New line
%% User-defined functions
function y = lim(f)
syms s;
y = limit(f,s,0);
if isnan(y)
y = inf;
end
end
function checkSystemType(Kp,Kv,Ka)
if ~isinf(Kp) && Kv == 0 && Ka == 0
disp('System type: 0');
elseif isinf(Kp) && ~isinf(Kv) && Ka == 0
disp('System type: 1');
elseif isinf(Kp) && isinf(Kv) && ~isinf(Ka)
disp('System type: 2');
end
end
0 comentarios
Ver también
Categorías
Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!