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

2 vues (au cours des 30 derniers jours)
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];

Réponse acceptée

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

Plus de réponses (0)

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by