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 (์ต๊ทผ 30์ผ)
์ด์ ๋๊ธ ํ์
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
๋ต๋ณ (1๊ฐ)
Walter Roberson
2021๋
10์ 6์ผ
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
์ฐธ๊ณ ํญ๋ชฉ
์นดํ ๊ณ ๋ฆฌ
Help Center ๋ฐ File Exchange์์ Symbolic Math Toolbox์ ๋ํด ์์ธํ ์์๋ณด๊ธฐ
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!