Linear interpolation of matrix

2 vues (au cours des 30 derniers jours)
Sohrab Sangini
Sohrab Sangini le 14 Juin 2018
Modifié(e) : Stephen23 le 14 Juin 2018
I have a set of data point which are represented in matrices. So basically I have one input and I get a matrix as an output. If i have two inputs which means two output matrices, how can I use linear interpolation to find the output matrix for a random input? Looking forward to your help.

Réponses (1)

Stephen23
Stephen23 le 14 Juin 2018
Modifié(e) : Stephen23 le 14 Juin 2018
>> M1 = [1,1,1;2,2,2];
>> M2 = [3,4,5;6,7,8];
>> P1 = 0;
>> P2 = 1;
>> Pq = 0.5; % your random point
>> V = [reshape(M1,1,[]);reshape(M2,1,[])];
>> Vq = interp1([P1;P2],V,Pq);
>> reshape(Vq,size(M1))
ans =
2.0000 2.5000 3.0000
4.0000 4.5000 5.0000

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by