Effacer les filtres
Effacer les filtres

error with interpn function "Grid arrays must have NDGRID structure"

29 vues (au cours des 30 derniers jours)
RR
RR le 2 Fév 2022
Commenté : Walter Roberson le 2 Fév 2022
Dear all,
I have two matrix a=10x2 and b= 10x2. they are the indipendent variables of an unknown function C(a,b)= 10x3. I would like to evaluate this function in Aq (100x2) and Bq (100x2) variable.
a % 10x2 matrix
b % 10x2 matrix
C % 10x3 matrix
% difine Aq 100x2 and Bq 100x2
a1=[min(a(:,1)):1:max(a(:,1))]';
a2=[min(a(:,2)):1:max(a(:,2))]';
Aq(:,1)=a1(1:100);
Aq(:,2)=a2(1:100);
b1=[min(b(:,1)):1:max(b(:,1))]';
b2=[min(b(:,2)):1:max(b(:,2))]';
Bq(:,1)=b1(1:100);
Bq(:,2)=b2(1:100);
%interp function C at Aq and Bq;
Cq = interpn(a,b,C,Aq,Bq)
I have this error
"Error using griddedInterpolant
Grid arrays must have NDGRID structure.
Error in interpn (line 151)
F = griddedInterpolant(X{:}, V, method,extrap);"
Why? what is wrong in my code?
thank you very much in advance
RR
  13 commentaires
RR
RR le 2 Fév 2022
Unfortunately griddatan outputs vq with is a vector of length p (p= number observation) while I would like to obtain instead a matrix of size px3.
Walter Roberson
Walter Roberson le 2 Fév 2022
Do three separate griddatan(), one for each column of C.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by