How do I interpolate between points without going beyond them?

Posted by user1774893 on Stack Overflow See other posts from Stack Overflow or by user1774893
Published on 2012-10-25T16:54:46Z Indexed on 2012/10/25 17:00 UTC
Read the original article Hit count: 192

Filed under:
|

I have data of variable lengths (reaching movements recorded in 2D) and want to create a function that will resample this data to a uniform length (500 samples).

However, I want matlab to only resample between the maximum and minimum values given, without adding any additional distance. For instance, if I resample the matrix [1:1:10], the resampled matrix should have a minimum value of 1 and a maximum value of 10.

So far I've tried the following:

x = [1:1:10];
interp(x, 500 / length(x));

This, however, gives values above my maximum specified value of 10.

Is there any way I can get matlab to resample/interpolate solely between two points, without extending beyond them?

© Stack Overflow or respective owner

Related posts about matlab

Related posts about interpolate