Help with the lsqcurvefit solver

  • Follow


Hello ,
 
I am trying to fit an experimental curve using MATLAB lsqcurvefit tool with a function that launches an ansys (Finite Element software) parametric model. Everything seems to work well, connection-wise since the FE model runs and give results. 

To launch the problem, I am using the next lines:
 x0 = [20;0.05];
[xhat,resnorm,residual,exitflag,output] = lsqcurvefit(@lintandyn2,x0,xdata,ydata);

"lintandyn2" being the function that generates, solves and postprocess the FE model, yielding a vector of predicted values of the same size that xdata and ydata.

However, my problem is with MATLAB as it does not seem to change the initial values and after three iterations (the three using the initial vector) tells:
"Initial point is a local minimum.
Optimization completed because the size of the gradient at the initial point 
is less than the default value of the function tolerance."

My first question is if this tool can be used in this way (FE solver substituting an equation). I guess so, and if that is the case why the second iteration does not change at least slightly any of the parameters.

Best regards and thank you in advance,
 
Rogelio
0
Reply Rogelio 1/26/2011 5:53:03 PM

While I do not understand exactly what ansys does, I suspect that 
lsqcurvefit sees the model as locally flat because it changes the 
parameters by such a small amount that ansys cannot see a difference.

If I am correct, then you should change the DiffMinChange option to 
something much larger than the default. Perhaps try 1e-4 or 1e-3 or even 
1e-2.
options = optimset('DiffMinChange',1e-4);

Alan Weiss
MATLAB mathematical toolbox documentation

On 1/26/2011 12:53 PM, Rogelio Perez wrote:
> Hello ,
>
> I am trying to fit an experimental curve using MATLAB lsqcurvefit tool
> with a function that launches an ansys (Finite Element software)
> parametric model. Everything seems to work well, connection-wise since
> the FE model runs and give results.
> To launch the problem, I am using the next lines:
> x0 = [20;0.05];
> [xhat,resnorm,residual,exitflag,output] =
> lsqcurvefit(@lintandyn2,x0,xdata,ydata);
>
> "lintandyn2" being the function that generates, solves and postprocess
> the FE model, yielding a vector of predicted values of the same size
> that xdata and ydata.
>
> However, my problem is with MATLAB as it does not seem to change the
> initial values and after three iterations (the three using the initial
> vector) tells:
> "Initial point is a local minimum.
> Optimization completed because the size of the gradient at the initial
> point is less than the default value of the function tolerance."
>
> My first question is if this tool can be used in this way (FE solver
> substituting an equation). I guess so, and if that is the case why the
> second iteration does not change at least slightly any of the parameters.
>
> Best regards and thank you in advance,
>
> Rogelio

0
Reply Alan 1/26/2011 7:19:43 PM


Hello Alan,
It is working now. As you guessed, the changes were so small that the format of the passing variables were not enough for Ansys to see any difference (and in turn Matlab).
Thanks a lot,
Rogelio

Alan Weiss <aweiss@mathworks.com> wrote in message <ihps4f$hqq$1@fred.mathworks.com>...
> While I do not understand exactly what ansys does, I suspect that 
> lsqcurvefit sees the model as locally flat because it changes the 
> parameters by such a small amount that ansys cannot see a difference.
> 
> If I am correct, then you should change the DiffMinChange option to 
> something much larger than the default. Perhaps try 1e-4 or 1e-3 or even 
> 1e-2.
> options = optimset('DiffMinChange',1e-4);
> 
> Alan Weiss
> MATLAB mathematical toolbox documentation
> 
> On 1/26/2011 12:53 PM, Rogelio Perez wrote:
> > Hello ,
> >
> > I am trying to fit an experimental curve using MATLAB lsqcurvefit tool
> > with a function that launches an ansys (Finite Element software)
> > parametric model. Everything seems to work well, connection-wise since
> > the FE model runs and give results.
> > To launch the problem, I am using the next lines:
> > x0 = [20;0.05];
> > [xhat,resnorm,residual,exitflag,output] =
> > lsqcurvefit(@lintandyn2,x0,xdata,ydata);
> >
> > "lintandyn2" being the function that generates, solves and postprocess
> > the FE model, yielding a vector of predicted values of the same size
> > that xdata and ydata.
> >
> > However, my problem is with MATLAB as it does not seem to change the
> > initial values and after three iterations (the three using the initial
> > vector) tells:
> > "Initial point is a local minimum.
> > Optimization completed because the size of the gradient at the initial
> > point is less than the default value of the function tolerance."
> >
> > My first question is if this tool can be used in this way (FE solver
> > substituting an equation). I guess so, and if that is the case why the
> > second iteration does not change at least slightly any of the parameters.
> >
> > Best regards and thank you in advance,
> >
> > Rogelio
0
Reply Rogelio 1/27/2011 9:07:32 AM

2 Replies
633 Views

(page loaded in 0.04 seconds)

Similiar Articles:













7/23/2012 7:57:38 PM


Reply: