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

21 views (last 30 days)
masoud meskin
masoud meskin on 11 Aug 2021
Commented: masoud meskin on 16 Aug 2021
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.
masoud meskin
masoud meskin on 16 Aug 2021
Oh! Thanks Alan. You saved my time. I made it hard for myself.
It is now working very well. I appreciate your help.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by