variable sweep in simulink

10 次查看(过去 30 天)
How do I sweep the value of a "gain block" in simulink? can I do a few iterations, each one with different value in the gain block? Thanks

采纳的回答

Thijs
Thijs 2011-11-13
in simulimnk change the name of the gain parameter to for example G. The value for G can then be specified from the workspace. So you can use a for loop like this one:
gain=[1:20];
for n=1:length(gain)
G=gain(n);
run('simulink_model_name')
end
using parfor instead of for can improve performance if you have a multiple core machine.
hope this helps
  1 个评论
Rahul Kumar
Rahul Kumar 2019-5-15
Update: If you are using R2017a or later, the parsim command can be used to set this up very easily.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by