Home > Back-end >  Find maximum deviation in range of between variables
Find maximum deviation in range of between variables

Time:05-28

How to write a command in Matlab to check the deviation between one variable and others to be within - ? as if not in the range would print false if within the range print true

For example, I want to compare R1,R2,R3 with R and should be with the range of plus/minus :

R = 0.62
R1 = 0.638
R2 = 0.6337
R3 = 0.6354

Thanks

CodePudding user response:

You want the absolute difference abs(var1-var2) to be smaller than some percentage. You compute the percentage by dividing a piece by the total abs(var1-var2)/var1. This value must be smaller than 0.2, so abs(var1-var2)/var1<0.2

  • Related