Relational operations problems (real and imag parts)

Hello all!
I want to replace this line
if imag(LAMBD(m,m)) ~= 0
into
if imag(LAMBD(m,m)) == 0
because the operation "~=" (even without imag()) is testing the imaginary part of LAMBD, but it doesn't work.
I have no idea why...
Thanks,
Kate

1 Comment

I'm skeptical that it doesn't work. And you haven't provided any illustration to prove it...

Sign in to comment.

 Accepted Answer

It seems that in this case "~=" doesn't mean testing the imginary part of LAMBD. if f(x) ~= 0 menas that f(x) is close to zero...

2 Comments

Ekaterina , dont add an answer, just add a comment

Sign in to comment.

More Answers (2)

Maybe it's about numerical problems, for example try this
0.3-0.2==0.4-0.3
%you will find 0
It would be difficult as I have 600 lines of code.

1 Comment

Matt J
Matt J on 25 Nov 2012
Edited: Matt J on 25 Nov 2012
Yes, and we wouldn't be interested in seeing all 600 lines of your code. However, only a small number of those lines are actually causing trouble. Therefore, it should be easy for you to construct a separate, small, simplified example based on those lines.

Sign in to comment.

Categories

Products

Tags

Community Treasure Hunt

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

Start Hunting!