필터 지우기
필터 지우기

Integrator doesn't work properly

조회 수: 4 (최근 30일)
Foad Sojoodi Farimani
Foad Sojoodi Farimani 2022년 2월 24일
답변: Foad Sojoodi Farimani 2022년 2월 25일
I am working on a controller that calculates the maximum velocity that the actuator can remove from the system so the kinetic energy is zero when achieving the set point. Please see the attachment.
the MATLAB Function block is:
function direction = dircVel(Xd, Xa, Va)
Fmax = 1;
m = 1;
Vmax = sqrt(2 * Fmax * abs(Xd - Xa) / m) * sign(Xd - Xa);
direction = sign(Vmax - Va);
What I expect to see is that the output approaches the setpoint position asymptotically but it diverges to infinity!
the output of the MATLAB function seems OK:
but the output of the first integration is wrong:
red line being what I expected to see.
I would appreciate it if you could help me know what is wrong and how I can resolve it.
P.S. I also posted the question here on Discord and here on Reddit.

채택된 답변

Foad Sojoodi Farimani
Foad Sojoodi Farimani 2022년 2월 25일
Thanks to this comment on Discord, I could figure the issue out. Basically the Sample rate on the Function block needs to be set manually. Right clock on the function block and select "Block Parameters (Subsystem)":
adjust the Sample time value to something smaller in this case 0.01 worked:
and the result is as expected

추가 답변 (1개)

Benjamin Thompson
Benjamin Thompson 2022년 2월 24일
The output of your first integrator is always positive. So the second integrator will keep increasing until its input become zero or negative.

카테고리

Help CenterFile Exchange에서 General Applications에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by