필터 지우기
필터 지우기

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

조회 수: 29 (최근 30일)
RR
RR 2022년 2월 2일
댓글: Walter Roberson 2022년 2월 2일
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.
Walter Roberson
Walter Roberson 2022년 2월 2일
Do three separate griddatan(), one for each column of C.

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

답변 (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