I have this code, it works, but with some warnigs and it doesn't look like other codes I see here, because I am not a programmer, but it is very helpul and I want to share it in file exchange. So would you please share your knowledge to make it look and function better, Thanks
% this file reads data, extrapolates and generates fit curves with given degree of polyfit.
clear allclcD=22;% degree of polyfit
Y_axis=xlsread('F:\KT312',1,'b5:v42');X_axis=xlsread('F:\KT312',1,'a5:a42');for i=1:size(Y_axis,2)Ys0=Y_axis(:,i);[x,~]=find(isfinite(Ys0));Xs=X_axis(x);Ys=Ys0(x);Xs2=linspace(Xs(1),Xs(end),100)';% extrapolation of the curve for a better precision
Ys2=spline(Xs,Ys,Xs2);fitYs=polyfit(Xs2,Ys2,D);Ysfit=zeros(size(Xs2));for j=1:length(fitYs)-1Ysfit(:,j)=fitYs(j)*Xs2.^(length(fitYs)-j);endYsfit=sum(Ysfit,2)+fitYs(length(fitYs));Ys2data(:,i)=Ys2;Ysfit_data(:,i)=Ysfit;Xs2_data(:,i)=Xs2;endclearvars -except Ys2data Ysfit_data Xs2_datadisplay 'done'
Best Answer