MATLAB Answers

0

Magnitude of difference from one vector (number) to another

Asked by Jasvir Bahl on 28 Apr 2017
Latest activity Commented on by KSSV
on 28 Apr 2017
Hi,
I have defined two vectors: X = -135.89 Y = -84.96066717
I want to determine how far away Y is compared to X (i.e. the return answer should be close to 50).
Can someone please help?

  1 Comment

Your X and Y are not vectors, they are scalars. You can get what you want using:
d = abs(abs(X)-abs(Y))

Sign in to comment.

0 Answers