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 CenterFile Exchange에서 Historical Contests에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by