How to upsample (increase) 2d points with interpolation

40 ビュー (過去 30 日間)
aposta95
aposta95 2022 年 5 月 31 日
コメント済み: Voss 2022 年 5 月 31 日
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)
  2 件のコメント
aposta95
aposta95 2022 年 5 月 31 日
Thanks a lot! You saved my day :)
Voss
Voss 2022 年 5 月 31 日
You're welcome!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultirate Signal Processing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by