I have eight 1024X1024 matrices corresponding to 8 thicknesses (0,5,10,15,20,25,30,35cm). My code below aims to retrieve a correct matrix for a given thickness, e.g. Th12…
I am getting this error:
??? Error using ==> interp1 at 259 The values of X should be distinct.
Error in ==> Predict_EPIDM at 122 CorrFactor = interp1(col,A,Th);
What is wrong with the code? __________________________________________________________________________
% There are 8 PT 0,5,10,15,20,25,30,35cm
PT=PhysicalThickness; % A is matrices 1024X1024 for the 8PTs. Size(A) returns 1024X1024X8.
A = cat(3, A{:}); % define the column number nearest to the input Th
Th=12;colindex=min(find(PT>=Th));% return the 'in between' A matrix
col=A(:,colindex)+((A(:,colindex)-A(:,colindex-1))*(Th-PT(colindex))/(PT(colindex)-PT(colindex-1)));% Using the RDepid value to find MUx
CorrFactor = interp1(col,A,Th);
Best Answer