필터 지우기
필터 지우기

Is this the correct optimization tool (lsqcurvefit,MultiStart)

조회 수: 1 (최근 30일)
Arbol
Arbol 2017년 6월 11일
댓글: Arbol 2017년 6월 14일
I have checked the Optimization tool box to see which one would be good for my optimization problem, so I thought lsqcurvefit would be good for my problem. Upon making a model with data with known parameters and trying to fit it with a model. The parameters estimated are not the same as the known parameters (or converge to the known parameters) that I first created the noisy data. What do you think is wrong with this? I'm also using MultiStart to find different initial points also.
%Creating data with noise:
tu is a (225x3) data
tdata is 225x1 =tu(:,1);
ptest=[0.2,0.1,0.25,0.05];
Tissue= odefnc_noise(ptest,tdata,tu);
%Fitting the data with noise
fun = @(p,tdatas) odefnc_test(p,tdatas,tu);
param0=[0.1 0.1 0.1 0.1];
problem = createOptimProblem('lsqcurvefit','objective',fun,...
'xdata',tdata,'ydata',Tissue,'x0',param0,'lb',[0 0 0 0],'ub',[1 1 1 1],...
'options',options);
[b,fval,exitflag,output,solutions]=run(ms,problem,2);
%Fitting Function
function Tissue= odefnc_test(p,texp,tu)
F=p(1);
fp=p(2);
fis=p(3);
PS=p(4);
init = [0 0];
[~,y]=ode45(@(t,x) myeqn(t,x,F,fp,fis,PS,tu), texp, init);
P=y(:,1);
I=y(:,2);
Tissue = (I+P);
function dx=myeqn(t,x,F,fp,fis,PS,tu)
output=interp1(tu(:,1),tu(:,2),t);
dx(1)= (F/fp)*(output-x(1))- (PS/fp)*(x(1)-x(2));
dx(2)= (PS/fis) *(x(1)-x(2));
dx=[dx(1);dx(2)];
end
end
This will converge to different value even if param0=ptest. So is it the ode function that create a problem? If 'fun' is not an ode, so it is like fun=@(b) b(1)*xdata +b(2)*xdata^2, the solution would converge according to many other problems I found online.
  댓글 수: 16
Walter Roberson
Walter Roberson 2017년 6월 14일
I have not run with your modifications yet. With the version before them, when I changed the tolerance and step size tolerance to some that looked reasonable, nearly all of the runs end with "Change in x was less than the specified tolerance." which is exit 2; the remaining run was at a higher function value and ran out of iterations (exit 0).
I pushed up the number of starts to 20, but by random chance the final output was not better than one of the runs with only 2 multistarts -- so the starting position is important.
Arbol
Arbol 2017년 6월 14일
Correct, the number of points doesn't make it any better. But the new correction code that I posted will make the fit better, but still doesn't give a good exitflag. Even when i raised the number of starts.

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

답변 (0개)

카테고리

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