How to upsample (increase) 2d points with interpolation

32 visualizaciones (últimos 30 días)
aposta95
aposta95 el 31 de Mayo de 2022
Comentada: Voss el 31 de Mayo de 2022
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!

Respuesta aceptada

Voss
Voss el 31 de Mayo de 2022
Editada: Voss el 31 de Mayo de 2022
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)
  2 comentarios
aposta95
aposta95 el 31 de Mayo de 2022
Thanks a lot! You saved my day :)
Voss
Voss el 31 de Mayo de 2022
You're welcome!

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by