I have three equations with names 'equn1, equn2, equn3'. Variables in those equations are declared as :
lam = sym('lam', [1 3] ).
To solve those equations, i am writing the code like this :
solu_fsolve = []; value = []; lam(1) = 0; lam(2) = 0; lam(3) = 0;fh = matlabFunction([equn1;equn2;equn3],'vars',{[ lam(1), lam(2), lam(3)]});options = optimset('Display','off','TolFun',eps);[solu_fsolve,value] = fsolve(fh, [ 1,1,1] ,options ) ;
But, when i execute this code , i am getting an error like :
??? Error using ==> sym.matlabFunction>checkVars at 155Variable names must be valid MATLAB variable names. Error in ==> sym.matlabFunction at 104vars = checkVars(funvars,opts);
Can anyone please tell me how to declare the array as variables in matlabfunction?
Please help.
–kalpana
Best Answer