Resampling a set of 2D Points to a certain value

8 次查看(过去 30 天)
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.

采纳的回答

KSSV
KSSV 2018-11-1
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 个评论
KSSV
KSSV 2018-11-9
Do the unique X's have unique y's? If so remove them.
Math Enthusiast
Math Enthusiast 2018-11-9
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.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by