Curve fitting toolbox error "NaN computed by model function, fitting cannot continue"
9 次查看(过去 30 天)
显示 更早的评论
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 个评论
Alan Weiss
2021-8-16
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
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!