I want to evaluate the difference (susbtraction) between all elements in a vector and have the maximum as a result.
For example with
[1 3 7]
the diffs are 2, 4 and 6, so that the result should be 6.
How can I do that with matlab in a clever way?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The maximum difference between any two elements in an array is the difference between the maximum and the minimum value of the array: