.m to .mdl
1 次查看(过去 30 天)
显示 更早的评论
hi, i have written a code in editor to find a value ,'phase_delay'
ip = menu('input is','ac','dc')% askin whether input is ac or dc
if ip==1
Vdc=inputdlg('dc output needed = ');
cos_alpha=((Vdc*pi)/(220)-1);
alpha=acosd(cos_alpha);
phase_delay=(alpha)/18000
end
now i want to put this value of phase_delay in "phase delay" of simulink/sources/pulse generator, automatically.
2 个评论
Walter Roberson
2012-2-25
Side question: what should be done if "ip" is _not_ 1 ?
Also, is it correct that you prompt for the DC output needed only when the user selects AC (the first option, ip == 1) ?
采纳的回答
Kaustubha Govind
2012-2-27
>> set_param('path/to/block', 'PhaseDelay', num2str(phase_delay))
Note that phase_delay needs to be converted to a string using num2str because set_param needs the value to be set as a string.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!