How to use scatteredInterpolant in case of dimensions more than 3
Mostra commenti meno recenti
Hello everyone I am trying to do a multivariate interpolation and i get the following error :
Error using interpn
NTIMES must be a single numeric value.
Error in FVP (line 277)
phi{i,k} = interpn(X',Val_phi{i,k}');
The same code works fine for 2D , however in case of 2D i used
phi{i,k} = scatteredInterpolant(X',Val_phi{i,k}');
and here is the piece of code that genrates the error:
%% Interpolate
VAL_PHI_CONCAT = [];
for i = 1:size(Val_phi,1)
textwaitbar(i, size(Val_phi,1), "Interpolating")
for k = 1:size(Val_phi,2)
disp('size of X')
size(X)
disp('Size of val_phi')
size(Val_phi{i,k})
disp([num2str(i),num2str(k)])
phi{i,k} = interpn(X',Val_phi{i,k}');
phi{i,k} = @(x)(phi{i,k}(x')');
VAL_PHI_CONCAT = [VAL_PHI_CONCAT ; Val_phi{i,k} ];
end
end
Some information about the dimension of the variables :
X : 6 12010
Val_phi{i,k} : 1 12010
It works fine for the first iteration of i.e. for i=1 and k = 1 and then throws error for k=2 ,i=1
Any suggestion on what possibly I am doing wrong?
Thank you .
4 Commenti
Bruno Luong
il 23 Ago 2022
Modificato: Bruno Luong
il 23 Ago 2022
"X : 6 12010
Val_phi{i,k} : 1 12010"
Something is not right.
If you are working in six dimension for X, then Val_phi cannot belong to the 6-dimensional space where X lives.
You want to interpolate in dimension 12010 with 6 points? Then this must be a joke.
Ajai Singh
il 23 Ago 2022
Bruno Luong
il 23 Ago 2022
I guess you just have tried INTERPN randomy without knowing what it does. That's why you still ask question about the error.
So we cannot take it as what kind of interpolation you want to do.
Ajai Singh
il 23 Ago 2022
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Interpolation in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!