Writing Code For a Function

i am Writing Code For a Function but error what is needed is control operation
also is there another way to delay the function work until after the system work for 3 sec to avoid the transition as prog wait stop the system only one time
function D = fcn(Vo, Vin, DesiredOutPut ,Di)
%#codegen
if Di == 0
Di = DesiredOutPut/(DesiredOutPut + Vin);
else
Di = D
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for i=0,i<1
prog::wait(3.0)
i= 2
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if Vo < DesiredOutPut
D = Di + 0.01;
elseif Vo > DesiredOutPut
D = Di - 0.01;
else
D = Di;
end

回答 (2 件)

Mischa Kim
Mischa Kim 2014 年 2 月 19 日
編集済み: Mischa Kim 2014 年 2 月 19 日

0 投票

Shreef, replace
prog::wait(3.0) % unless you are using MuPAD (symbolic)
by
pause(3)
What are you trying to do in the for-loop? At the moment, you enter the loop with i=0, set i=2 and therefore exit the loop right away, since i>1.
shreef
shreef 2014 年 2 月 20 日

0 投票

i used for to make it one time wait as the input changing constantly but with pause i remove for-loop still getting error
as you can see i am trying to control a sepic converter i tried pid but could not be linearized so i went to use more direct approach by using that vo=vin*D/(1-D) >> D=Vo/(Vo+Vin) so by changing D I can control Vo as Vin Change that in ideal work so i use desiredoutput input to get Dinitial and work my way up or down to get desiredoutput From Current Vo Di Must be a variable i tried using syms Di Got Error Still getting error it is my first time knowing the programing blocks i tried to search but can not controll how i write completely

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

質問済み:

2014 年 2 月 19 日

回答済み:

2014 年 2 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by