interpulation of 2 axes in 3D matrix
3 ビュー (過去 30 日間)
古いコメントを表示
i have 3D L matrix:
L(:,:,1)=
1 3 5
7 9 11
13 15 17
L(:,:,2)=
3 5 7
9 11 13
15 17 19
i want to interpulate L but only in 2 axes, the wanted solution:
L(:,:,1)=
1 2 3 4 5
7 8 9 10 11
13 14 15 16 17
L(:,:,2)=
2 3 4 5 6
8 9 10 11 12
14 15 16 17 18
L(:,:,3)=
3 4 5 6 7
9 10 11 12 13
15 16 17 18 19
from L(3x3x2) to L(3x5x3).
i tried to use interpn but i got interpulation in x axes as well.
LL=interp(L,1)
LL(:,:,1)=
1 2 3 4 5
4 5 6 7 8
7 8 9 10 11
10 11 12 13 14
13 14 15 16 17
LL(:,:,2)=
2 3 4 5 6
5 6 7 8 9
8 9 10 11 12
11 12 13 14 15
14 15 16 17 18
LL(:,:,3)=
3 4 5 6 7
6 7 8 9 10
9 10 11 12 13
12 13 14 15 16
15 16 17 18 19
0 件のコメント
回答 (1 件)
Stephen23
2022 年 4 月 6 日
format compact
L = cat(3,[1,3,5;7,9,11;13,15,17],[3,5,7;9,11,13;15,17,19])
Xi = 1:3;
Yi = [1,3,5];
Zi = [1,3];
[Xq,Yq,Zq] = ndgrid(1:3,1:5,1:3);
A = interpn(Xi,Yi,Zi,L,Xq,Yq,Zq)
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!