1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| %% DATA %%
GWC1 = [68 57] ;
Tcri = [160 409] ;
GWC2 = [62 54] ;
Tcri2 = [199 399] ;
GWC3 = [58 69] ;
Tcri3 = [496 176] ;
GWC4 = 54 ;
Tcri4 = 616 ;
GWCtot=[GWC1 GWC2 GWC3 GWC4] ;
Tcritot = [Tcri Tcri2 Tcri3 Tcri4] ;
[GWCtot2 idxTOT2] = sort(GWCtot);
Tcritot2 = Tcritot(idxTOT2);
%% FIT %%
predicted = @(coef,GWCtot) coef(1)*exp(coef(2).*GWCtot); %model
a0=[13000;0.1]; % valeurs départ itération
[ahat,resnorm,residual,exitflag,output,lambda,jacobian]=lsqcurvefit(predicted,a0,GWCtot,Tcritot)
xfit=[45:0.1:70] ;
y = ahat(1)*exp(ahat(2).*xfit);
%% PLOT %%
figure
hold on
plot(GWCtot, Tcritot,'bs','LineWidth',2,'MarkerFaceColor','b');
plot(xfit, y,'r','LineWidth',2) |
Partager