Actually, I am trying to fit a differential equation () to some data using lsqcurvefit. I enetered my initial value in a way that completely fit to the data and I know that it should easily fit because I tried it with cftool. But my code cannot fit the result of the differential equation to my data and gives the following message in command window:
Optimization completed because the size of the gradient at the initial point is less than the value of the optimality tolerance.
Could you please help me to make my differential equation fit to the experimental data?
[d,s,r] = xlsread('Temp.csv');
x = d(:,1);
B0 = [0.521e6,294.15,1.5];
[B,Rsdnrm,Rsd,ExFlg,OptmInfo,Lmda,Jmat] = lsqcurvefit(@firstorderDSC1,B0,Time,f1);
The following is "firstorderDSC1" function;
function dndt2 = firstorderDSC1(B, t)
[time,n] = ode45(@firstorderDSC, t, 0);
dndt2(i,1) = firstorderDSC(n(i), time(i));
function denaturate = firstorderDSC(n, t)
I have also attached "Temp.csv"