custom fittype error ??Matrix dimensions must agree
이전 댓글 표시
Hi All,
I have a customer function dIdVdei that takes 10 inputs and outputs a value. I'd like to fit a function to that, varying 8 of the inputs for the fit, one of the inputs as an independent variable, and 1 as a fixed problem variable.
I create a custom fittype as so:
independentvars = {'V'};
dependentvars = {'y'};
problemvars = {'T'};
coeffvars = {'omega', 'G', 'Aw', 'uL', 'uM', 'g1', 'g2', 'dIdV0'};
expression = 'dIdVdei( V, T, omega, G, Aw, uL, uM, g1, g2, dIdV0)'; %just call the function
func = fittype(expression, 'coefficients', coeffvars, 'independent', independentvars, 'dependent', dependentvars, 'problem', problemvars);
The dIdVdei code works fine on its own, but when I try to create that fittype I get the error:
Expression dIdVdei( V, T, omega, G, Aw, uL, uM, g1, g2, dIdV0) is not a valid MATLAB expression, has
non-scalar coefficients, or cannot be evaluated:
Error in fittype expression ==> dIdVdei( V, T, omega, G, Aw, uL, uM, g1, g2, dIdV0)
??? Matrix dimensions must agree.
I'm having trouble figuring out what the cause is; note this is before trying to fit anything, its just creating the fittype object. Some of the inputs (omega, G, and Aw) can be vectors, but at this point the code shouldn't even know that so I don't see how that could be the problem.
Any advice is appreciated, thanks!
답변 (1개)
카테고리
도움말 센터 및 File Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!