Linear interpolation of matrix
14 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Stephen23
on 14 Jun 2018
Edited: Stephen23
on 14 Jun 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
0 Comments
See Also
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!