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

4 次查看(过去 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
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.

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