simulink模块中如何设置一个时变的参数变量 。
134 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
本人在做电机的参数辨识,使用simulink搭建了电机模型,可是里面有个参数(转子电阻)我要让他是时变的,我想通过m函数对模型的参数进行统一赋值,大家有什么好的方法?
0 Kommentare
Akzeptierte Antwort
dejom
am 27 Nov. 2022
我尝试给你做了一个能满足需求的小例子,你看下是不是你想要的。模型如Fig 1所示:其中:
增益模块中的参数为需要动态调节的函数。
自定义Matlab函数模块中的函数定义为为:
function y = userfun(t)
set_param('testing11/Gain','Gain',num2str(t));
y = t;
另外:需要在 菜单栏 File->Model Parameters->Model Parameters->Callbacks->InitFcn中设定初始的模块参数:
set_param('testing11/Gain','Gain','0'),我设定的初始参数为0。
运行结果如Fig 2所示:
注意:Constant模块中的 Sample time 不能是 inf
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Electromechanical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!