.m to .mdl

8 ビュー (過去 30 日間)
prasoon purwar
prasoon purwar 2012 年 2 月 24 日
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
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) ?
prasoon purwar
prasoon purwar 2012 年 2 月 27 日
so sorry ,
please take ac as default ie ip==1, always

サインインしてコメントする。

採用された回答

Kaustubha Govind
Kaustubha Govind 2012 年 2 月 27 日
Do you want to set it on a model that is already open? If yes, you can use the set_param command:
>> 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.
  1 件のコメント
prasoon purwar
prasoon purwar 2012 年 2 月 27 日
@kaustubha govind ,is there any any way to update the value of phase delay in pulse generator block in simulink.
i mean, using subsystem masking in simulink i m changing the value of a variable according to my need , now i want that simultaneously the value of phase delay changes it self,proportional to change in variable.
or tell me whether it is feasible or not,
PLEASE ,PLEASE DO REPLY

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSources についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by