posts - 81, comments - 259, trackbacks - 0

October 2010 Blog Posts

Generating a Symbolic Vector in Matlab

Matlab's symbolic toolbox is great for abstracting algebraic operations. For example, generating Lagrange basis functions. However, when generalizing an operation of order n, n symbolic variables are needed. Creating n symbolic variables in Matlab isn't as obvious as creating a static set of symbols. For example:  syms x y  vs.  syms x1 x2 x3 … xn  Fortunately the function sym takes a string argument and returns the symbolic variable. This way we can build a string for each xi, and append the resulting variable into a container such as a vector. Generating n symbolic variables can be done like so  % generate xi symbolic values xi = []; for (i=1:n) ...

posted @ Friday, October 1, 2010 7:59 PM | Feedback (3) |

Powered by:
Powered By Subtext Powered By ASP.NET