Linear interpolation of matrix
Afficher commentaires plus anciens
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)
>> 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 Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!