在从s函数驱动步进电机时,必须得到脉冲发生器的参数。我所要做的就是调整脉冲发生器的周期参数,以便能够调整步进motor.However,我不知道如何在simulink上通过s函数或matlab函数来达到它们。任何帮助都将不胜感激。谢谢。
发布于 2017-08-18 06:03:11
我不确定我是否明白你的问题,但你可以简单地从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工作区中指定一个输出,然后执行与上述代码类似的操作。
希望我明白你的意思。
https://stackoverflow.com/questions/45237497
复制相似问题