# Approximate Equality in Matlab

186 visualizzazioni (ultimi 30 giorni)
Ganesh Kini il 22 Apr 2020
Risposto: David Hill il 22 Apr 2020
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 ?
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (2)

Walter Roberson il 22 Apr 2020
if abs(A-B) < tolerance
There is no operator symbol for approximate equality -- no A?=B or anything like that.
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

David Hill il 22 Apr 2020
tol=.2;%whatever you want
abs(B-A)<tol;
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Logical in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by