如何使用fittype函数来定义下面的自定义方程?如何使用fittype函数来定义自定义方程?
y = a(x1^b)(x2^c)(x3^d)(x4^e)(x5^f)(x6^g).
我尝试以下的代码:
ft = fittype('a*(x1^b)*(x2^c)*(x3^d)*(x4^e)*(x5^f)*(x6^g)',...
'independent',{'x1','x2','x3','x4','x5','x6'},...
'dependent',{'y'},...
'coefficients',{'a','b','c','d','e','f','g'});
但它引发此错误:
Expression a*(x1^b)(x2^c)(x3^d)(x4^e)(x5^f)*(x6^g) is not a valid MATLAB expression, has non-scalar coefficients, or cannot be evaluated: Not enough inputs to FITTYPE function.
你的代码不应该给出错误。你显示的错误告诉我们你的表达式是无效的,因为'*'没有被多次包含,但它包含在你的示例代码中。 –