The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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,850
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
> 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]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.