hey. I keep getting an error for this code. If anyone could help me it would be greatly appreciated.
์กฐํ ์: 4 (์ต๊ทผ 30์ผ)
์ด์ ๋๊ธ ํ์
Sachini Perera
2021๋
10์ 6์ผ
clear;
clc;
a = [1,12];
b = [1,15,54];
rt = tf(a,b);
% b) Determine the steady state errors for the open-loop systems below with the following inputs: 8๐ข(๐ก), 8๐ก๐ข(๐ก), and 8๐ก2๐ข(๐ก).
syms s;
num = a;
den = poly2sym(b,s);
gs = num/den;
es = 8/(1+lim(gs)); % Steady-state error with step input
er = 8/(lim(s*gs)); % Steady-state error with ramp input
ep = 8/(lim(s^2*gs)); % Steady-state error with parabola input
fprintf('b) Determine the steady state errors:\n\t\t with step input = %.3f,\n\t\t with ramp input = %.3f,\n\t\t with parabola input = %.3f\n', es, er, ep)
%% User-defined functions
function y = lim(f)
syms s;
y = limit(f,s,0);
if isnan(y)
y = inf;
end
end
๋๊ธ ์: 0
์ฑํ๋ ๋ต๋ณ
Chetan Bhavsar
2021๋
10์ 6์ผ
ํธ์ง: Chetan Bhavsar
2021๋
10์ 6์ผ
It was because value of (1+lim(gs)) was
a=(1+lim(gs))
a =
[55/54, 11/9]
clear;
clc;
a = [1,12];
b = [1,15,54];
rt = tf(a,b);
% b) Determine the steady state errors for the open-loop systems below with the following inputs: 8๐ข(๐ก), 8๐ก๐ข(๐ก), and 8๐ก2๐ข(๐ก).
syms s;
num = a;
den = poly2sym(b,s);
gs = num/den;
es = 8./(1+lim(gs)); % Steady-state error with step input
er = 8./(lim(s*gs)); % Steady-state error with ramp input
ep = 8./(lim(s^2*gs)); % Steady-state error with parabola input
fprintf('b) Determine the steady state errors:\n\t\t with step input = %.3f,\n\t\t with ramp input = %.3f,\n\t\t with parabola input = %.3f\n', es, er, ep)
%% User-defined functions
function y = lim(f)
syms s;
y = limit(f,s,0);
if isnan(y)
y = inf;
end
end
Is output as per expectation?
๋๊ธ ์: 0
์ถ๊ฐ ๋ต๋ณ (1๊ฐ)
Paul
2021๋
10์ 6์ผ
Should num also use poly2sym? Otherwise, gs is 1 x 2 transfer function matrix, which may be what you want, but maybe not.
If you really do want gs to be 1 x 2, then you need to change the divide to dot-divide for es and er and ep.
es = 8./(1+lim(gs)); % was es = 8/(1+lim(gs));
๋๊ธ ์: 0
์ฐธ๊ณ ํญ๋ชฉ
์นดํ ๊ณ ๋ฆฌ
Help Center ๋ฐ File Exchange์์ Calculus์ ๋ํด ์์ธํ ์์๋ณด๊ธฐ
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!