Calculating the maximum distance between elements of vector in MATLAB?

If you do, then something like this will work: max(x) - min(x) If you don't, then I've misunderstood the question.

Uhh... would love to have a MATLAB at my hands and its still early in the morning, but what about something like: max_dist = max(x(2:end) - x(1:end-1)); I don't know if this is what You are looking for.

That would calculate the maximum distance between succeeding elements. I'd rather like to have have it over all possible combinations. – lhahne Mar 16 '10 at 8:02.

This is an interpoint distance computation, although a simple one, since you are working in one dimension. Really that point which falls at a maximum distance in one dimension is always one of two possible points. So all you need do is grab the minimum value and the maximum value from the list, and see which is farther away from the point in question.So assuming that the numbers in x are real numbers, this will work: xmin = min(x); xmax = max(x); maxdistance = max(x - xmin,xmax - x); As an alternative, some time ago I put a general interpoint distance computation tool up on the file exchange (IPDM).

It is smart enough to special case simple problems like the 1-d farthest point problem. This call would do it for you: D = ipdm(x,'subset','farthest','result','struct'); Of course, it will not be as efficient as the simple code I wrote above, since it is a fully general tool.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions