I am trying to fit this expression: the τ's are stress variables for three different temperatures. I have tried the following but fitting is way off. Could someone suggest a better/correct way to do this please?
%%%%a1=3.304*1.005%%%%
Eb_112T_a1=[1.7425 1.2007 0.7870 0.4811 0.2401 0.0541];stress_112T_a1=[5.4876 5.5985 5.684 5.7465 5.7834 5.7958 ];%%%%a2=3.304*1.01%%%%
Eb_112T_a2=[1.6581 1.1312 0.7297 0.4370 0.2080 0.0348];stress_112T_a2=[5.4266 5.5390 5.627 5.6909 5.7304 5.7457];%%%%a3=3.304*1.02%%%%
Eb_112T_a3=[1.4527 0.9538 0.5814 0.3186];stress_112T_a3=[5.2062 5.318 5.4078 5.474];Temp=[1831 3779.6 7.6773e3];tau=[ stress_112T_a1 stress_112T_a2 stress_112T_a3];Eb=[Eb_112T_a1 Eb_112T_a2 Eb_112T_a3];dsid = [1*ones(length(stress_112T_a1),1); 2*ones(length(stress_112T_a2),1); 3*ones(length(stress_112T_a3),1)];T = [tau' dsid];b = nlinfit(T,Eb',@subfun,[35 5.9 2 8000])H_pred1=b(1).*(1-(stress_112T_a1./b(2)).^b(3)).*(1-Temp(1)./b(4));H_pred2=b(1).*(1-(stress_112T_a2./b(2)).^b(3)).*(1-Temp(2)./b(4));H_pred3=b(1).*(1-(stress_112T_a3./b(2)).^b(3)).*(1-Temp(3)./b(4));figure(1)hold all% plot(stress_112T_a0, Eb_112T_a0,'o')
% plot(stress_112T_a0, H_pred1)
plot(stress_112T_a1, Eb_112T_a1,'s')plot(stress_112T_a1, H_pred1)plot(stress_112T_a2, Eb_112T_a2,'d')plot(stress_112T_a2, H_pred2)plot(stress_112T_a3, Eb_112T_a3,'p')plot(stress_112T_a3, H_pred3)hold offfunction yfit = subfun(params,T)Temp=[1831 3779.6 7.6773e3]';X = T(:,1); dsid = T(:,2); A0 = params(1); A1 = params(2);A2=params(3);A3=params(4);yfit = (A0.*(1-(X./A1)).^A2).*(1-Temp(dsid)./A3).*heaviside(1-(X./A1)).*heaviside(1-Temp(dsid)./A3);end
Best Answer