See matlabFunction, and pay close attention to the 'vars' option.If you knew that each cell entry was the same size, then you could cat() everything along higher dimensions after some reshape() ) For example, syms a 1 3 creates the symbolic array a a1 a2 a3 and the symbolic scalar variables a1, a2, and a3 in the MATLAB workspace. However, symbolic arrays cannot contain sub-arrays or vectors or cells: symbolic arrays must have each element be a scalar symbolic value and the array overall must be cuboid. For brevity, an array of symbolic scalar variables is also called a symbolic array. You indicate that each element of the cell array contains a matrix and that you want to convert the cell to symbolic.You can pass in symbolic values as extra parameters by parameterizing, but whatever computation you do must return scalar single() or double() Your objective function for fmincon must return something scalar and numeric.The symbolic expression or function can never be used as x0 or A or b or Aeq or beq or lb or ub, and f and nonlcon require function handles not symbolic values. The only way to pass a symbolic expression or function into fmincon is to parameterize a function, passing the value in as an extra parameter. You can allocate y like this: y sym (zeros (1,3. Because x is a symbolic variable rather than a symbolic value, Matlab cannot perform the automatic cast back to double precision. a is numeric, but when you multiply it by x the result becomes symbolic. fmincon() does not accept symbolic expressions or functions as any parameter. The problem is that you allocated y as a numeric (floating-point) array, not a symbolic one.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |