4-D Interpolation using interpn

조회 수: 40 (최근 30일)
mary
mary 2022년 11월 26일
댓글: mary 2022년 11월 27일
Hi,
I have 4 vectors as input and 1 vector as output. I want to do an interpolation following the instructions given here:
where Xq1, ..., Xq4 are scalars and equal to Xqi = Xi(1) (it is just a test).
However, I got the following error:
Interpolation requires at least two sample points for each grid dimension.
If I look at section 4-D Interpolation, it can be seen that 4D grids are constructed and after these points are passed through the function and a 4D structure is obtained for V.
In my case, I don't have a function. I just have a vector for the output V.
How I can make it work with my vector type of data?
  댓글 수: 13
Torsten
Torsten 2022년 11월 27일
Yes, that is what I want to do.
Then why don't you call your function V(X1,X2,X3,X4) over a full grid as required by "interpn", save the results in an array V(x1,x2,x3,x4) and then use this V-array for a table-lookup by "interpn" ?
Something like
for i = 1:597
for j = 1:597
for k = 1:597
for l = 1:597
V(i,j,k,l) = function_for_V(X1(i),X2(j),X3(k),X4(l));
end
end
end
end
mary
mary 2022년 11월 27일
I'll do that. Thank you.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by