Hello Everyone,
I am rather new to Matlab and right now are running slightly into a wall. I want to fit data from a 3D matrix and extract the fit parameters into tables, i.e. my parameters are a, b, c, d, e etc. and I basically want for each x-y value of my matrix a new matrix with the respective fit parameter for that x-y coordinate. I got so far to get the fitting working, when I write the a from my first loop, that obviously works, but in the second loop the a value of that loop just replaces my a from the first loop, and so on.
The Matlab version I work with is R2014a.
for i=1:512 for j=1:640 y2=A(i,j,:); y1=y2(:,2:nFiles); y=transpose(y1); x1=2 : nFiles; x=transpose(x1); try F = fit(x,y,'a*exp(-x/b)+c*exp(-x/d)+g','Algorithm', 'Levenberg-Marquardt','Robust', 'Bisquare' ,'MaxIter', 50, 'StartPoint', [40 0.5 1 75 0]); plot(F,x,y); R = coeffvalues(F); ParamA = table(R(1:1)); catch ME end endend
Best Answer