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)';
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!