if condition problem programing

1 回表示 (過去 30 日間)
mado
mado 2013 年 2 月 5 日
i want to do this flow chart but i got obstacle on my way which i pointed to in the picture in this link http://www.mediafire.com/view/?2tkvty7sq9d419o i did this code but it'snot working please help. thanks
if V>Vold %v(k-1)=vold if I==Iold return
elseif I>Iold %I(k-1)=Iold
dvref=Vref+c
else dvref=Vref-c
end
elseif dI==-I/V
return
elseif dI/dV > -I/V
dvref=Vref+c
else
dvref=Vref-c
end
  1 件のコメント
Jan
Jan 2013 年 2 月 5 日
  1. I do not understand what you are asking for. What is the question?
  2. I cannot see anything useful at the posted link. Most likely I have to play around with the switchs to accept external scripts in my browser, but I do not like to lower my security level only to understand a question. Please contact TMW and ask for a possibility to host pictures on a TMW server.
  3. "It is not working" is not useful. Please explain, if you get an error message (if so, which one) or if the results differ from your expectation (if so, how).

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

回答 (1 件)

mado
mado 2013 年 2 月 5 日
1-the question is how to code this flowchart? 2- mediafire is safe you download the pic safely . 3- not working means that it should give constant value when I=Iold or dI /dV=-I/v but it don't , the output is ramp this code is implemented in embedded matlab function
function dvref =IC(V,I)
persistent Vref Vold Iold c; if isempty(Vold) Vold=0; %initialized only once in the beginning end if isempty(Iold) Iold=0; %initialized only once in the beginning end if isempty(c) c = .1; %initialized only once in the beginning end if isempty(Vref) Vref=5; %initialized only once in the beginning end
dI=I-Iold; dV=V-Vold;
if V>Vold if I==Iold return
elseif I>Iold
dvref=Vref+c
else dvref=Vref-c
end
elseif dI==-I/V
return
elseif dI/dV > -I/V
dvref=Vref+c
else
dvref=Vref-c
end
Iold=I Vold=V Vref=dvref;
  2 件のコメント
Jan
Jan 2013 年 2 月 5 日
Please do not post this as an answer, when it is a comment to another comment.
mado
mado 2013 年 2 月 5 日
sorry i didn't notice that , i hope that you got my question

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

カテゴリ

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

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by