Why Does My Plot Not Match My Numbers?

Hi all,
I am not fluent in matlab nor this community, so I apologise if this is not the right place to ask this question. However I'm trying to plot the velocity error of a transfer function multiplied by a proportional control (nonzero constant). My calculations show that the velocity error should be a nonzero constant, however it appears as though the error tends to infinity as t tends to infinity. I'm more confident in my math, than I am in my coding of matlab, so I think the issue is on the coding side. If I am flawed in my approach, it would be greatly appreciated if someone could point it out.
Essentially the code being used.
s = tf('s');
gs = k*(a*s + b) / (s^3 + c*s^2 + d*s)
Unrecognized function or variable 'k'.
Kp = 3.7
cl_lp_err = feedback(1, Kp*gs) %Creating an error closed loop system
t = 0:0.1:200;
figure(1)
hold on
step(1/(s*cl_lp_err))
hold off
figure(2)
hold on
plot(t, 1*t)
hold off

댓글 수: 2

Image Analyst
Image Analyst 2022년 5월 14일
What value are you using for k?
the cyclist
the cyclist 2022년 5월 14일
... and a, b, c, d.

댓글을 달려면 로그인하십시오.

답변 (1개)

Sam Chak
Sam Chak 2022년 5월 14일

0 개 추천

Since the values for the parameters are not provided, they are assumed in the following, which should give you a general idea on how to work out the problem. I'm unsure, but the syntax in your feedback appears to be incorrect. Better provide the math since it will clarify everything.
% parameters (assumed)
a = 1;
b = 1;
c = 1;
d = 1;
k = 1/3.7;
% the Laplace variable
s = tf('s');
% Transfer function of the system in open loop
gs = k*(a*s + b) / (s^3 + c*s^2 + d*s)
% proportional gain
Kp = 3.7;
% Transfer function of the closed-loop system
gcl = feedback(Kp*gs, 1)
% step response of the closed-loop system
step(gcl)
% if you want to simulate until 200 sec
step(gcl, 200)

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

제품

릴리스

R2022a

질문:

2022년 5월 14일

답변:

2022년 5월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by