simulink模块中如何设置一个时变的参数变量 。

137 views (last 30 days)
deponox
deponox on 27 Nov 2022
Answered: dejom on 27 Nov 2022
本人在做电机的参数辨识,使用simulink搭建了电机模型,可是里面有个参数(转子电阻)我要让他是时变的,我想通过m函数对模型的参数进行统一赋值,大家有什么好的方法?

Accepted Answer

dejom
dejom on 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
  1 Comment
jia liu
jia liu on 8 May 2023
这个能应用电机上吗,突增转子电阻

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!