
% Define the data sets that you are trying to fit the
% function to
X = [1:300];
Y = Pt_data1(:,6);
% Initialize the coefficients of the function
X0=[1.5 3 10]';
Y_new = 0*X; 
params=[1.5 10000 250];
% Set an options file for LSQNONLIN to use the
% medium-scale algorithm
%options = optimset('Largescale','off');
 
% Calculate the new coefficients using LSQNONLIN
%[params,resnorm]=lsqnonlin(@fit_simp_alkili_practice,X0,[],[],options,X,Y);
 
% Plot the original and experimental data
A=1.5;
B=1;
C=250;
n=300;
for k=1:20
    %Y_new =1.+Y_new;
for i=1:n    
Y_new(i) = Y_new(i) + (120*zeta(5)- exp(-1*k*Z_new(i))*(Z_new(i)^5+(5/k)*Z_new(i)^4+(20/k^2)*Z_new(i)^3+(60/k^3)*Z_new(i)^2+(120/k^4)*Z_new(i)+120/k^5))*X(i)^5;
end
end
Q_new = (1/C^6).*Y_new;
plot(X,Y_new,'b')