






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of matlab's symbolic toolbox, which allows users to create symbolic objects, perform symbolic operations such as differentiation, integration, and analytical solution techniques for equations, and work with symbolic matrices for calculus and linear algebra. Creating symbolic objects using the sym function and syms command, calculus functions like diff, int, taylor, limit, and jacobian, and linear algebra functions like diag, triu, tril, inv, det, rank, rref, null, colspace, eig, svd, jordan, poly, and expm.
Typology: Study notes
1 / 10
This page cannot be seen from the preview
Don't miss anything!







Matlab’s Symbolic Toolbox is a collection of functions that provide access to some of Maple’s functionality.objects, which represent expressions, and perform symbolic operations on Using this toolbox, one can create sym them, such as differentiation, integration, or analytical solution techniquesfor equations.
The sym function creates a new Matlab object that represents an expression, similar to an expression in Maple. It accepts as an argument a string repre-senting the expression, and returns an object whose value is that expression.
pression, such as whether the expression is assumed to be a real number, orAn optional second argument can be used to set properties of the ex- a positive number. bolic representation of the matrix is created. An optional second argumentInstead of a string, one may pass a matrix to^ sym, in which case a sym- indicates how the floating-point entries are to be represented symbolically.The argument ’f’ is used to create a floating-point representation, ’r’ for a rational representation (the default),error”, which implies ’r’ but also provides an estimate of the error in the ’d’ for decimal, and ’e’ for “estimate rational approximation.
myexpr=sym(’x’) myexpr =
x
myexpr2=sym(’x^2’) myexpr2 = x^ sym([ 1/3 ]) ans = 1/ sym([ 1/3 ],’f’) ans = ’1.5555555555555’*2^(-2) sym([ 1/3 ],’d’) ans = . sym([ 1/3 ],’e’) ans = 1/3-eps/
The syms command is used as a shortcut for creating several symbolic variables. The arguments to syms are each passed to sym. For each argu- ment, a new object is created with the same name as the argument, and itsvalue equal to the symbolic variable of that name. syms cannot be used to create symbolic objects representing arbitrary expressions.ments, syms lists all symbolic variables. With no argu-
limit(1/x,x,0,’left’) ans = -inf syms y; jacobian([ exp(xy) x^2y ],[x y]) ans = [ yexp(xy), xexp(xy)][ 2xy, x^2]
The following functions, many of which are familiar, work with symbolic matrices.
The following functions may be used to rearrange expressions, with the goal of simplifying them. They accept an expression or a matrix of expressions.
simplify(cos(x)^2+sin(x)^2) ans = 1
S=solve(’u+v=1’,’u-v=0’,’u’,’v’) S = u: [1x1 sym]v: [1x1 sym]
S.u ans = 1/ dsolve(’D2y=-y’,’y(0)=1’,’Dy(0)=1’) ans = cos(t)+sin(t) compose(exp(x),sin(x)) ans = exp(sin(x)) finverse(exp(x)) ans = log(x)
Matlab can use Maple’s variable precision arithmetic.uates each element of its argument using variable precision floating point vpa numerically eval- arithmetic, withreturned by digits D decimal digits of accuracy, where. digits, with no arguments, returns the current preci- D is the current value sion. It accepts an integer argument, which becomes the new precision.
digits
Digits = 32
vpa(1/3) ans = . digits(16);>> vpa(1/3)
ans = .
Often, it is desirable to convert between data used in symbolic operations and data used with Matlab’s own functions.