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

29 次查看(过去 30 天)
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 个评论
RR
RR 2022-2-2
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.

请先登录,再进行评论。

回答(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