lsqnonlin - multiple variables

2 次查看(过去 30 天)
Yongchul Shin
Yongchul Shin 2019-9-18
I want to create a castro-macosko equation code where viscosity is a function of temperature and degree of cure. here is my code.
---------------------------------------------------------------------------------------------
sr=187.5; % shear rate (s^-1)
macosko_0=[3*10^(-1), 6000, 10^(-4), 0.3, 0.9, 4, -0.1]; % B, Tb, tau*, n, alpha_g(>alpha), c1, c2
no_ext=702;
temp_ext=load('temp_BS19_ext.m'); % experimental temperature data
alpha_ext=zeros(no_ext,1); % experimental degree of cure data
eta_ext=load('eta_BS19_ext.m'); % experimental viscosity data
temp_ext=temp_ext+273.15;
for i=1:(no_ext-no)
alpha_ext(i)=0;
end
for i=(no_ext-no+1):no_ext
alpha_ext(i)=alpha(i-(no_ext-no));
end
options = optimset ('Largescale','off');
macosko=lsqnonlin(@fitting_macosko,macosko_0,[],[],options,temp_ext,alpha_ext,eta_ext);
mt=real(macosko);
macosko=mt;
eta_sim=zeros(no_ext,1);
% to compare model values (eta_sim) to experimental values (eta_ext)
for i=1:no_ext
eta_sim(i) = macosko(1)*exp(macosko(2)./temp_ext(i))./(1+((macosko(1)*exp(macosko(2)./temp_ext(i))*sr/macosko(3)).^(1-macosko(4)))).*(macosko(5)/(macosko(5)-alpha_ext(i))).^(macosko(6)+macosko(7).*alpha_ext(i));
end
figure(5)
semilogy(temp_ext, eta_ext, 'bo', temp_ext, eta_sim, 'r')
xlabel('temp (K)');
ylabel('viscosity (Pa.s)');
% grid on;
-------------------------------------------------------------------------------------------------
AND the objective function is
------------------------------------------------------------------------------------------------------
function parameter = fitting_macosko(macosko,temp_ext,alpha_ext,eta_ext)
sr=187.5; % shear rate s^(-1)
parameter = macosko(1)*exp(macosko(2)./temp_ext)./(1+((macosko(1)*exp(macosko(2)./temp_ext)*sr/macosko(3)).^(1-macosko(4)))).*(macosko(5)/(macosko(5)-alpha_ext)).^(macosko(6)+macosko(7).*alpha_ext)-eta_ext;
---------------------------------------------------------------------------------------------------------
where is eta_ext is viscosity which is function of temp_ext, and alpha_ext.
After run, it hasn't error, but the plots of eta_ext(the experimental data), and eta_sim to check the model values are very different.
In particular, the point of rapid increase in viscosity due to curing is very different.
Please help if somebody have experience about this.
Thanks in Advance.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 General Applications 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by