MATLAB: Undefined variable, passive variable vector

passive variable vectorundefined variableunknown variable vector

HELLO do you know how should i make vector with passiv variable.and be aware of that the size of this vector will be defined in the middel of program. thanks

Best Answer

See the documentation for sym and in particular this part:
A = sym('A', [m n]) creates a m-by-n matrix of symbolic variables. The dimensions m and n of a matrix must be integers. You can use this syntax to create a 1-by-n or an n-by-1 vector. The sym function does not allow you to use symbolic variables without assigned numeric values as dimensions. By default, the generated names of elements of a vector use the form Ak, and the generated names of elements of a matrix use the form Ai_j. The base, A, must be a valid variable name. (To verify whether the name is a valid variable name, use isvarname). The values of k, i, and j range from 1 to m or 1 to n. To specify other form for generated names of matrix elements, use '%d' in the first input. For example, A = sym('A%d%d', [3 3]) generates the 3-by-3 symbolic matrix A with the elements A11, A12, ..., A33