Calculating the maximum distance between elements of vector in Matlab

Posted by lhahne on Stack Overflow See other posts from Stack Overflow or by lhahne
Published on 2010-03-16T07:31:43Z Indexed on 2010/03/16 7:36 UTC
Read the original article Hit count: 250

Filed under:
|
|
|

Lets assume that we have a vector like

x = -1:0.05:1;
ids = randperm(length(x));
x = x(ids(1:20));

I would like to calculate the maximum distance between the elements of x in some idiomatic way. It would be easy to just iterate over all possible combinations of x's elements but I feel like there could be a way to do it with Matlab's built-in functions in some crazy but idiomatic way. Any ideas?

© Stack Overflow or respective owner

Related posts about matlab

Related posts about distance