Error using griddedInterpolant The grid vectors do not define a grid of points that match the given values

조회 수: 1 (최근 30일)

Hey all, I keep getting this error message: "Error using griddedInterpolant The grid vectors do not define a grid of points that match the given values." Even though when I debug it step by step, the error appears nonsensically! Any help is greatly appreciated. Here is the code:

%READING DATA
b=400;h=400;fc=30;
Row=1472;
Data=xlsread('Thermocouples_2017-02-14_09-41-57.csv');
T=[20 100 200 300 400 500 600 700 800 900 1000 1100];
RF_fc_Calcar=[1 1 .97 .91 .85 .74 .6 .43 .27 .15 .06 .02];
Strain_c1Theta=[.0025 .004 .0055 .007 .01 .015 .025 .025 .025 .025 .025 .025];
Strain_cu1Theta=[.02 .0225 .025 .0275 .03 .0325 .035 .0375 .04 .0425 .045 .0475];
X_Channel=[0 5 10 42 75 400];
T_Conc=[Data(Row-4,8) Data(Row-4,9) Data(Row-4,12) Data(Row-4,11) Data(Row-4,10) Data(Row-4,22)];
c=200;
%DATA ANALYSIS
F_Conc=0;M_Conc=0;
for x=0.0000001:1:c
      T_c=interp1(X_Channel,T_Conc,x);
      Strain_c1Theta=interp1(T,Strain_c1Theta,T_c);
      T_c0=interp1(X_Channel,T_Conc,0);
      Strain_cEdge=interp1(T,Strain_cu1Theta,T_c0);
      Strain_c=Strain_cEdge*(1-x/c);
      fc_Calcar=interp1(T,RF_fc_Calcar,T_c)*fc;
      Stress=3*Strain_c*fc_Calcar/(Strain_c1Theta*(2+(Strain_c/Strain_c1Theta)^3));
      if x<h F_Conc=F_Conc+Stress*(1)*b;end
      Z_Conc=0.5*h-x;
      if x<h M_Conc=M_Conc+Stress*(1)*b*Z_Conc;end
      j=j+1;
  end

채택된 답변

Michelangelo Ricciulli
Michelangelo Ricciulli 2017년 3월 7일
Hi! The error comes in the second iteration of the for loop. In fact when you call
Strain_c1Theta=interp1(T,Strain_c1Theta,T_c);
the first time it works fine since T and Strain_c1Theta have the same dimensions. Then you overwrite it! So it will change dimension (becoming a scalar) while T is still a vector 1x12. I don't know the actual purpose of your function, so I don't know how to modify it to make it work properly.
  댓글 수: 1
Zakaria Askif
Zakaria Askif 2017년 3월 11일
편집: Zakaria Askif 2017년 3월 11일
Thank you! I just realised that it should be named differently:
Strain_c1ThetaX=interp1(T,Strain_c1Theta,T_c);
Now it should work. Cheers!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Language Support에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by