Changing gain parameter in matlab function block during simulink simulation
4 ビュー (過去 30 日間)
古いコメントを表示
Hi, I need to change gain/constant parameter in Simulink during the simulation. Sometimes it need to be changed and sometimes it doesn't, so I try to do it in the Matlab function block. Anyway, I didn't find a solution without a GUI... I already tried set_param function but it doesn't work in matlab function block.
My real issue is to set PD controller until the condition isn't true. Than I need only PID controller no matter the condition.
Thanks for help in advance
function [PD, PID] = PID_switch(PID_set, error)
if PID_set == 0
PD = error;
PID = 0;
else
PID = error;
PD = 0;
end
if condition == 1
PID_set = 1;
end
end

0 件のコメント
回答 (1 件)
Umang Pandey
2023 年 9 月 25 日
Hi Jan,
As per my understanding, it appears that you are interested in employing the "PD" control block until a specific condition remains unfulfilled. Once this condition is met, the system should transition to the "PID" control block.
To facilitate this, I suggest utilizing the "Switch" block in Simulink. This block enables you to route one of its inputs to its output based on a specified "Threshold" parameter.
For a comprehensive understanding and examples, you may refer to the following documentation:
Best,
Umang
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で General Applications についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!