Approximate Equality in Matlab

So i have two values
A = 1.69 and B = 1.8
A = 2.1 and B = 2.4
How do i show it that they are approximately equal without using round
are there any relational operators that i can use ?

Antworten (2)

Walter Roberson
Walter Roberson am 22 Apr. 2020

0 Stimmen

if abs(A-B) < tolerance
See also ismembertol()
There is no operator symbol for approximate equality -- no A?=B or anything like that.
David Hill
David Hill am 22 Apr. 2020

0 Stimmen

tol=.2;%whatever you want
abs(B-A)<tol;

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 22 Apr. 2020

Beantwortet:

am 22 Apr. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by