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.

답변 (1개)

Stephen23
Stephen23 2018년 6월 14일
편집: Stephen23 2018년 6월 14일

0 개 추천

>> 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

카테고리

도움말 센터File Exchange에서 Interpolation에 대해 자세히 알아보기

질문:

2018년 6월 14일

편집:

2018년 6월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by