Clear Filters
Clear Filters

Resampling a set of 2D Points to a certain value

8 views (last 30 days)
Hi,
I have set of 2D Points in a matrix.Lets assume,that its size is around 30. I would like to resample it to around 55 points,with no duplication of points as well as retaining the initial coordinates.
I would be really glad,if someone can let me know regarding this.

Accepted Answer

KSSV
KSSV on 1 Nov 2018
Let x and y be your 2D points which are 30 in number.
xi = linspace(min(x),max(x),50) ;
yi = interp1(x,y,xi) ;
iwant = [xi yi]
  3 Comments
KSSV
KSSV on 9 Nov 2018
Do the unique X's have unique y's? If so remove them.
Math Enthusiast
Math Enthusiast on 9 Nov 2018
I modified my code like this :
[x, index] = unique(x);
xi = linspace(min(x),max(x),70) ;
yi = interp1(x,y(index),xi) ;
iwant = [xi yi];
scatter(xi,yi,'r');
But result looks really bad :(.
The initial and final (after interpolating look like this):
Hope you understand,what I exactly need.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!