Curve fitting with 5 variables

5 次查看(过去 30 天)
Redwood
Redwood 2013-4-14
Dear Matlab experts,
I want to code curve fitting with 5 variables.
I got this message from Matlab, "Too many input arguments."
I added my code here, and I want to know how to solve this problem.
Thank you in advance.
Sincerely yours,
Redwood
%%Fit: 'China'.
[xData, yData, wData, cData, zData] = prepareSurfaceData( x, y, w, c, z );
% Set up fittype and options.
ft = fittype( 'a+ b*x +c*y + d*w + e*c', 'independent', {'x', 'y', 'w', 'c'}, 'dependent', 'z' );
opts = fitoptions( ft );
opts.Display = 'Off';
opts.Lower = [0 0 0 0 0];
opts.StartPoint = [0.01 0.01 0.01 0.01 0.01];
opts.Upper = [Inf Inf Inf Inf Inf];
% Fit model to data.
[fitresult, gof] = fit( [xData, yData, wData, cData], zData, ft, opts );
  5 个评论
Redwood
Redwood 2013-4-15
I got this in Matlab.
Error using prepareSurfaceData (line 31) Too many input arguments.
Sincerely your,
Redwood
Walter Roberson
Walter Roberson 2013-4-15
prepareSurfaceData's changes are specifically documented; you can undertake them yourself; see http://www.mathworks.com/help/curvefit/preparesurfacedata.html

请先登录,再进行评论。

回答(1 个)

Valeria Alejandra
编辑:Valeria Alejandra 2024-9-6
The "fit" function only supports two independent variables and you are trying to add four.
Since you are adding more than two elements in "here", then there are more than expected and matlab returns the error
fitobject = fit([here],z,fitType)

类别

Help CenterFile 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!

Translated by