Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: if condition problem
Replies: 3   Last Post: Feb 5, 2013 12:20 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 9,242
Registered: 6/7/07
Re: if condition problem
Posted: Feb 5, 2013 9:50 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 2/5/2013 2:44 AM, mado wrote:
> 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

> if I==Iold
> return

> dvref=Vref+c
> else

> elseif
> return
> elseif

dI/dV > -I/V
> dvref=Vref+c
> else

> end

A) What, specifically, is "not working"? Input, expected output and
result obtained...

B) What are the variables? Particularly if they're arrays/vectors
rather than simple variables then be aware of the Matlab definition of
logical comparisons--a logical operation on a vector/array returns a
logical vector/array of the same size and a comparison is T iff all
values in that vector/array are T.

C) Remember floating point comparisons for exactly == are fraught w/ the
problem of precision--much better will be to use a tolerance or recast
so the exactly equal "==" test isn't performed explicitly.

D) As a stylistic choice you might consider CASE constructs...

doc isequal


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2015. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.