How to upsample (increase) 2d points with interpolation

22 次查看(过去 30 天)
Hi, I want to upsampling 2d points (x,y) with interpolation.
Variable 'pts' contains 4x2 points (plot below), and I want to increase it to 1009x2 points, and the shape of 2d plot should not be changed.
I tried interp1 as below, but it changes the overall shape of plot.
load points
figure; plot(pts(:,1),pts(:,2))
vr = linspace(min(pts(:,1)), max(pts(:,1)), 1009);
ve = linspace(min(pts(:,2)), max(pts(:,2)), 1009);
B = interp1(1:length(pts(:,1)),pts(:,1),vr);
C = interp1(1:length(pts(:,2)),pts(:,2),ve);
plot(B,C)
How can I increase points of x, y without changing the shape of plot?
Maybe I think using interp2 would help, but I didn't understand the logic..
I attached a data, so please take a look at it!

采纳的回答

Voss
Voss 2022-5-31
编辑:Voss 2022-5-31
load points
figure;
plot(pts(:,1),pts(:,2),'LineWidth',6)
hold on
n = size(pts,1);
BC = interp1(1:n,pts,linspace(1,n,1009));
plot(BC(:,1),BC(:,2),'.r','MarkerSize',3)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by