HELLO
I am trying to make the algorithm of conversion ( experimental data to prony series param) using Matlab
I had some problem
Do you know if there is a function which allows to implement minimization algorithm
Do you have an script example using matlab to do it?
best regards
Pierre
If you use Matlab then it should be rather straightforward to create a program that does that conversion. The Matlab function that you are asking about is fminsearch (http://www.mathworks.com/access/helpdesk/help/techdoc/ref/index.html?/access/helpdesk/help/techdoc/ref/fminsearch.html).
I don't know if I have a polished script that I can share, I'll take a look...
Jorgen
Hello
As you said, i tried to use the fminsearch function in matlab
But it don't converge. I don t know if i have to sum the two error terms or use an other method:
the inputs are: xdata (=w); ydata1 (=G') ; ydata2 (=G")
function [estimates, model] = fitcurve(xdata, ydata2,ydata1)
% Call fminsearch with a starting point.
start_point = [69800,1,1,0001,000.1,000.1,000.1,000.1,00.1,0.1,0. 1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,1,1,1,1,1,1,1,1, 1,1,0.1,0.1,1,1,1,1,1,1,1,1,1,1
model = @expfun;
options=optimset('MaxFunEvals',1E+25,'MaxIter',1E+ 25);
estimates = fminsearch(model, start_point,options);
function [sse, FittedCurve1] = expfun(params)
G0= params(1);
A1 = params(2);
lambda1 = params(3);
A2 = params(4);
lambda2 = params(5);
% Calculation of G"
numpart1= xdata.*lambda1.^2;
numpart2= xdata.*lambda2.^2;
G'' = G0*(( numpart1*A1 ./(lambda1.^2 * xdata.^2+1)+ numpart2*A2./(lambda2.^2 * xdata.^2+1)
% Calculation of G'
denumpart1=xdata.^2*lambda1.^2;
denumpart2=xdata.^2*lambda2.^2;
G' =G*((1-(A1+A2))+(denumpart1*A1 ./(lambda1.^2 * xdata.^2+1)+denumpart2*A2 ./(lambda2.^2 * xdata.^2+1));
FittedCurve1 = G";
FittedCurve2 = G';
ErrorVector1 = abs(FittedCurve1 - ydata2)+abs(FittedCurve2 -ydata1);;
sse = sum(ErrorVector1 .^ 2)
end
end
thanks for your help
best regards
Pierre
Here are a few comments:
- Your function at first glance looks OK. I would recommend, however, that you add comments to your code in order for other people to better understand what your approach!
- What is the start_point vector? Why it is so long??
- Do you really want Matlab to take 1e25 interations?? Why?
- I don't quite follow your calculation of G' and G", can you explain more?
- In general, lack of convergence is typically due to either a bad starting guess for the parameters, or an objective function that does not have a minimum.
Jorgen
vBulletin® v3.7.4, Copyright ©2000-2008, Jelsoft Enterprises Ltd.