multidimensional interpolation of various look-up-tables at same point (interpn)

1 view (last 30 days)
Hello,
I've been searching for an answer for the following problem. Although it seemed, that the question ocurred sometimes, I couldn't find the solution.
I have 4 look-up-tables. Each of them shows a value of a variable in dependency of 4 parameters (p1,p2,p3,p4). p1=p2=p3=p4=[1,2,3,4,5].
Each parameter has for example 5 points, which leads to 5^4=625 values. The data ist stored in 4 array D1,D2,D3,D4 which contain d1_1 ...d1_625 etc. Hence: size(D1)=5 5 5 5; as are size(D2),size(D3) and size(D4).
Now I interpolate for example the values for [p1,p2,p3,p4]=[1,1.4,3,3.4]
I can do this by [P1,P2,P3,P4]=ngrid(p1,p2,p3,p4); and val1=interpn(P1,P2,P3,P4,D1,1,1.4,3,3.4); val2=intterpn(...,D2,...); ...
All 4 datasets are evaluated at the same point (in the same grid). Is it posible to evaluate the complete data within one interpn-call?
I have to inteprolate quite a lot of times during my simulation, so I think this could save some time. I assume that it takes some time for the function to find the position of the nodes, so this would have to be done only once.
Thank you and best regards!

Answers (0)

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!