Curve fitting toolbox error "NaN computed by model function, fitting cannot continue"

11 visualizaciones (últimos 30 días)
Hello,
I have a set of experimental data on which i am trying to fit 5 analytical functions (Hyperelastic models) using Levenberg-Marquardt algorithm. The models are as follows:
1) Neo-Hookean: y=2*c1*(x^2-1/x)
2) Yeoh: y=2*(x^2-1/x)*(c1+2*c2*(x^2+2/x-3)+3*c3*(x^2+2/x-3)^2)
3) Mooney-Rivlin: y=2*(x^2-1/x)*(c1+c2/x)
4) Ogden-N3: y=c1*(x^c2-2^(-1+c2)*x^(-c2/2))+c3*(x^c4-2^(-1+c4)*x^(-c4/2))+c5*(x^c6-2^(-1+c6)*x^(-c6/2))
5) Humphrey: y=2*(x^2-1/x)*c1*c2*exp(c2*(x^2+2/x-3))
The data file is attached so you can simply use the custom equation, use the above analytical functions, in the curve fitting toolbox.
clc; clear all; close all;
A = readmatrix('Specimen_mean.csv');
Xdata = A(:,1); % stretch [mm/mm]
Ydata = A(:,2); % Stress [Pa]
The 1,2 and 3 fit very well, though 4 and 5 cannot be fit to the data. The 4 gives the error "NaN computed by model function, fitting cannot continue" and the 5 gives the message "Fit computation did not converge". I have no idea how to deal with the mentioned problems. Any help would be highly appreciated.
Sincerely
Masoud
  6 comentarios
Alan Weiss
Alan Weiss el 16 de Ag. de 2021
I am not sure why you didn't use the Levenberg-Marquardt algorithm in lsqcurvefit when running MultiStart. That might save a step (no curve fitting toolbox needed).
options = optimoptions('lsqcurvefit','Algorithm','levenberg-marquardt');
problem = createOptimProblem('lsqcurvefit',...
'objective',model,'xdata',xData','ydata',yData','x0',[-1e6 -1e-3],'lb',[-1e7 -1],...
'ub',[1e7 1],'options',options);
Alan Weiss
MATLAB mathematical toolbox documentation
masoud meskin
masoud meskin el 16 de Ag. de 2021
Oh! Thanks Alan. You saved my time. I made it hard for myself.
It is now working very well. I appreciate your help.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Get Started with Curve Fitting Toolbox en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by