Lsqnonlin_Fitting Data

조회 수: 1 (최근 30일)
Fredic
Fredic 2020년 10월 8일
댓글: Fredic 2020년 10월 11일
Hello Guys!!
I am performing a fitting of different curves using lsqnonlin. My fitting equation is composed of six parameters. When I run my script I obtained one set of parameters for each curve.
It is possible to perform the fitting using only one set of parameters for each curve??
In the attachment my script:
x0 = [10.07 5.89 21.62 0.116 0.493 47.99];
coeff = zeros(6,mm);
LB=[0 0 0 0 0 0];
UB=[inf inf inf 1 0.5 90];
sig_fit_11 = zeros(nn,mm);
sig_fit_22 = zeros(nn,mm);
for i=1:mm
options = optimoptions(@lsqnonlin,'Algorithm','trust-region-reflective');
[x,resnorm,residual,exitflag]=lsqnonlin(@(x)f_const(Lam11(:,i), Lam22(:,i), x) - [sigma11(:,i); sigma22(:,i)],x0,LB,UB,options);
coeff (:,i) = x;
sigma = f_const(Lam11(:,i), Lam22(:,i), x);
sig_fit_11(:,i) = sigma(1:nn);
sig_fit_22(:,i) = sigma((nn+1):end);
end
I look forward to your reply!!!
Thank you very much

답변 (1개)

Alex Sha
Alex Sha 2020년 10월 8일
Hi, if possible, please post out your data of each curve, as well as the fitting equation.
  댓글 수: 4
Fredic
Fredic 2020년 10월 9일
function [sigOutput]=f_const(Lam11,Lam22,x)
c=x(1);
k1=x(2);
k2=x(3);
kip=x(4);
kop=x(5);
alpha=x(6);
A=2*kop*kip;
B=2*kop*(1-2*kip);
lam3 = 1./(Lam11.*Lam22);
I1=(Lam11.^2+Lam22.^2+lam3.^2);
I4=Lam11.^2.*cosd(alpha).^2+Lam22.^2.*sind(alpha).^2;
In=lam3.^2;
E4=A.*I1+B.*I4+(1-3*A-B).*In-1;
sig1=(c+4.*(A+B.*cosd(alpha).^2).*k1.*E4.*exp(k2.*E4.^2)).*Lam11.^2-(c+4*(1-2*A-B).*k1.*E4.*exp(k2.*E4.^2)).*lam3.^2;
sig2=(c+4.*(A+B.*sind(alpha).^2).*k1.*E4.*exp(k2.*E4.^2)).*Lam22.^2-(c+4*(1-2*A-B).*k1.*E4.*exp(k2.*E4.^2)).*lam3.^2;
sigOutput=[sig1;sig2];
end
Fredic
Fredic 2020년 10월 11일
do you have an idea?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Curve Fitting Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by