if condition problem programing

1 Ansicht (letzte 30 Tage)
mado
mado am 5 Feb. 2013
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 Kommentar
Jan
Jan am 5 Feb. 2013
  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).

Melden Sie sich an, um zu kommentieren.

Antworten (1)

mado
mado am 5 Feb. 2013
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 Kommentare
Jan
Jan am 5 Feb. 2013
Please do not post this as an answer, when it is a comment to another comment.
mado
mado am 5 Feb. 2013
sorry i didn't notice that , i hope that you got my question

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Historical Contests finden Sie in Help Center und File Exchange

Tags

Noch keine Tags eingegeben.

Community Treasure Hunt

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

Start Hunting!

Translated by