fitting experimental data with the model + Monte-Carlo
4 views (last 30 days)
Show older comments
Hello, I am trying to run this code and it's giving an error that matrix dimensions must not agree. I tried but did not resolve the issue. please suggest something
if
function [fitresult, gof] = createFit(t, y)
t=[24.88503903 78.50497273 139.9636403 194.6529783 297.4975938 397.283713];
y=[45.00727678 36.79417319 37.5451424 33.05702304 30.41701789 28.98254504];
nsample=1000;
for i=1:nsample
DD=1e12+2e12*randn(1);
self_coff=0.08+0.04*randn(1);
line_energy=0.5+0.5*randn(1);
%conversion_factor=0.32+0.06*randn(1);
threshold_stress=25.9e9*2.86e-10.*sqrt(DD).*((0.5.*line_energy)+sqrt(self_coff));
ave_strainrate=2.86e-10*1e12.*sqrt(DD);
[xData, yData] = prepareCurveData( t, y );
ft = fittype( strcat('(',num2str(threshold_stress)),'+((0.89.*s)*(1-((8.617e-5.*x)./F).*log(6.667e-4,'./strcat('(',num2str(ave_strainrate)),'))).^(1/q))^(1/p)))./(0.33))', 'independent', 'x', 'dependent', 'y');.
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.Lower = [1.1 0.667 1.5 3];
opts.StartPoint = [1.8 0.667 1.5 4];
opts.TolX = 1;
opts.Upper = [3.2 0.667 1.5 25];
end
% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft, opts );
end
0 Comments
Answers (0)
See Also
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!