Curve fitting with 5 variables

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

Walter Roberson
Walter Roberson 2013년 4월 15일
Which line is reporting too many input arguments?
Which MATLAB version are you using?
Redwood
Redwood 2013년 4월 15일
Dear Walter,
I am using Matlab R2012a.
I would like to know whether curve fitting can be worked with many variables (more than 4).
Also, I would like to know whether my coding is correct or not.
Sincerely yours,
Redwood
Image Analyst
Image Analyst 2013년 4월 15일
Answer his first question so he can help you. Copy and paste all the red error text that you are getting.
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일
편집: Valeria Alejandra 2024년 9월 6일

0 개 추천

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)

카테고리

도움말 센터File Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

태그

질문:

2013년 4월 14일

편집:

2024년 9월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by