0

在尝试从 s 功能驱动步进电机时,我必须达到脉冲发生器的参数。我要做的是调整脉冲发生器的周期参数,以便能够调整步进电机。但是,我不知道如何通过 s-function 或 matlab 函数在 simulink 上达到它们。任何帮助将不胜感激。谢谢。

4

1 回答 1

0

我不确定我是否收到了您的问题,但是您可以像这样简单地从 matlab 设置参数;

set_param('test_project/Pulse Generator','Period','0.1');

或者

set_param('test_project/Pulse Generator','Period','a_variable');

其他参数相同;

set_param('test_project/Pulse Generator','Amplitude','an_other_var*2*pi');
set_param('test_project/Pulse Generator','Amplitude','100');
set_param('test_project/Pulse Generator','Pulse Width','eps');

例如,这可以在 for 循环中完成;

for j=1:1:10
    set_param('test_project/Pulse Generator','Period','j*2*pi');
    % do other things here...
end

您也可以从 s-function 执行此操作,在 matlab 工作区中指定一个输出,然后执行类似于上述代码的操作。

希望我明白你的意思。

于 2017-08-17T22:03:10.630 回答