Problem with creating multidimensional, multiparameter fit
1 view (last 30 days)
Show older comments
I've been trying to create a 6-dimensional, 15-parameter fitting function defined in the following way:
func = strcat('(a11*sin(2*pi*x/365.25) + b11*cos(2*pi*x/365.25)',...
'+ a12*sin(4*pi*x/365.25) + b12*cos(4*pi*x/365.25)).*(a21*sin(pi*y/12)',...
'+ b21*cos(pi*y/12) + a22*sin(pi*y/6) + b22*cos(pi*y/6) + a23*sin(pi*y/3)',...
'+ b23*sin(pi*y/3)) + m*w + (a*v.^2 + b*v + c).*u + d');
ft = fittype(func,...
'independent',{'x','y','w','v','u'},'dependent',{'z'},...
'coefficients',{'a11','b11','a12','b12','a21','b21','a22','b22',...
'a23','b23','m','a','b','c','d'});
I get the following error:
Error using fittype/testCustomModelEvaluation (line 12)
Expression (a11*sin(2*pi*x/365.25) + b11*cos(2*pi*x/365.25)+ a12*sin(4*pi*x/365.25) +
b12*cos(4*pi*x/365.25)).*(a21*sin(pi*y/12)+ b21*cos(pi*y/12) + a22*sin(pi*y/6) + b22*cos(pi*y/6) + a23*sin(pi*y/3)+
b23*sin(pi*y/3)) + m*w + (a*v.^2 + b*v + c).*u + d is not a valid MATLAB expression, has non-scalar coefficients, or cannot be
evaluated:
Not enough inputs to FITTYPE function.
Error in fittype>iCreateFittype (line 371)
testCustomModelEvaluation( obj );
Error in fittype (line 328)
obj = iCreateFittype( obj, varargin{:} );
Note that this is an extension of a fit I was creating earlier with success which was 3-dimensional fit with no u,v, or w dependence and without the associate coefficients. Despite my best efforts, I have been unable to find my syntax error in this relatively simple extension. Is there something simple and/or important I'm missing?
0 Comments
Answers (0)
See Also
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!