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

13 visualizzazioni (ultimi 30 giorni)
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 Commenti
Alan Weiss
Alan Weiss il 16 Ago 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 il 16 Ago 2021
Oh! Thanks Alan. You saved my time. I made it hard for myself.
It is now working very well. I appreciate your help.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Curve Fitting Toolbox in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by