Please help with the correct syntax for this interpolation (interp2)

1 ビュー (過去 30 日間)
Hi,
I want to use a 2D-interpolation, but I do not understand the syntax of interp2. I simplified my acutal problem so it is easier to concentrate on what is going on.
Let say I have matrix A and I want to use interp2 to obtain matrix B. I want to have linear interpolation resulting in a matrix in which the steps between points in the last row of A become exactly 1. What should be the syntax so I can use a similar solution for my actual problem.
A = [2 4 6 8 10;
1 2 3 4 10];
% Here should be something like B = interp2(A,XXXXXXXX) to obtain the result below.
B = [2 4 6 8 8.3333 8.6667 9 9.3333 9.6667 10
1 2 3 4 5 6 7 8 9 10];

採用された回答

Bjorn Gustavsson
Bjorn Gustavsson 2021 年 3 月 3 日
That seems like a task for interp1:
B(2,:) = A(2,1):A(2,end);
B(1,:) = interp1(A(2,:),A(1,:),'linear');
HTH

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by