Linear interpolation of matrix

2 visualizaciones (últimos 30 días)
Sohrab Sangini
Sohrab Sangini el 14 de Jun. de 2018
Editada: Stephen23 el 14 de Jun. de 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.

Respuestas (1)

Stephen23
Stephen23 el 14 de Jun. de 2018
Editada: Stephen23 el 14 de Jun. de 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

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by