How to create points set on 2D polyline

조회 수: 17 (최근 30일)
abuzer
abuzer 2016년 4월 12일
답변: abuzer 2016년 4월 13일
Dear All,
I would like to write a code which creates point feature or matrix on the line with specific sampling interval.
For example as seen below code I have 7 point coordinates (x,y),
Now the problem is I would like to increase these point set with giving sampling interval of point 0.1.
Then create new points set.
data= [0 0;
1 1;
2 2;
3 2;
4 1;
5 1.25;
6 3.25];
figure
plot(data(:,1),data(:,2),'r+');
Thanks in advance.
Mustafa

채택된 답변

abuzer
abuzer 2016년 4월 13일
I have found the solution.
Linear interpolation is ok for this purpose.
data= [0 0;
1 1;
2 2;
3 2;
4 1;
5 1.25;
6 3.25];
figure
plot(data(:,1),data(:,2),'r+');
hold on
xq= min(data):0.1:max(data);
yq = interp1(data(:,1),data(:,2),xq);
plot(xq,yq,'k o');

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by