Thread Subject: compare values with margin

Subject: compare values with margin

From: rubionelove

Date: 15 Jun, 2009 08:48:02

Message: 1 of 3

Dear sirs,
I've to compare 2 values with a tolerance
something like this :

if a = b +-20
     do something
end

I don't know how to express this tolerance in matlab sintax

regards,
thanks to all in advance

Subject: compare values with margin

From: us

Date: 15 Jun, 2009 08:58:01

Message: 2 of 3

"rubionelove " <rubionelove@gmail.com> wrote in message <h151s1$5nf$1@fred.mathworks.com>...
> Dear sirs,
> I've to compare 2 values with a tolerance
> something like this :
>
> if a = b +-20
> do something
> end
>
> I don't know how to express this tolerance in matlab sintax
>
> regards,
> thanks to all in advance

one of the solutions

     crit=abs(a-b)<20;
if any(crit) % in case A and/or B are vecs...
%
end

us

Subject: compare values with margin

From: rubionelove

Date: 15 Jun, 2009 09:07:01

Message: 3 of 3

thank you us
have a nice day

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
any us 15 Jun, 2009 04:59:06
abs us 15 Jun, 2009 04:59:06
code us 15 Jun, 2009 04:59:05
compare values rubionelove 15 Jun, 2009 04:49:04
rssFeed for this Thread

Contact us at files@mathworks.com