Symbolic Math Toolbox: Quick Reference Sheet: Algebra Calculus
Symbolic Math Toolbox: Quick Reference Sheet: Algebra Calculus
Algebra Calculus
subs Symbolic substitution: limit Compute limit of symbolic expression:
syms a b; limit(1/x,x,0,'left')
subs(a^3+b,{a,b},{2,sym('e')})
diff Differentiation:
double Convert symbolic values to double precision: syms x t; diff(sin(x^2+t),x)
symN = sym(pi);
doubleN = double(symN) int Definite and indefinite integrals:
syms x z; int(x/(1 + z^2), z)
solve Equations and systems solver:
syms a b u v; symsum Sum of a series:
S=solve(u+v==a, u-v==b) syms k n; symsum(k,0,n-1)
rhs Right side (RHS) of equation: hessian Hessian matrix of scalar function:
syms x y; rhs(x^2 >= y^2) syms x y z;
hessian(x*y + 2*z*x, [x, y, z])
rewrite Rewrite expression in terms of another function:
syms x; rewrite(tan(x)/cos(x),'sin') laplacian Laplacian of scalar function:
syms x y z;
laplacian(1/x + y^2 + z^3, [x y z])
jacobian Jacobian matrix:
syms x y z u v;
jacobian([x*y*z; y; x+z],[x y z])
Graphics
divergence Divergence of vector field:
syms x y z;
fplot Plot symbolic expression or function:
divergence([x^2 2*y z], [x y z])
syms x; f(x) = sin(x)/x; fplot(f)
fplot3 Plot 3-D parametric curve:
syms x; fplot3(sin(x),cos(x),log(x))
fsurf Plot 3-D surface, mesh or contour:
syms x y;
f(x,y)=x*exp(-x^2-y^2); fsurf(f) Functions
fmesh Plot 3-D mesh:
syms x y; functions Symbolic Functions:
f(x,y)=x*exp(-x^2-y^2); fmesh(f) syms x y; f(x,y) = x + 2*y;
f(1,2)
fcontour Plot contours:
f(x,y)=x*exp(-x^2-y^2); fcontour(f) piecewise Conditionally defined expression or
function:
fimplicit, Plot implicit symbolic equation or function: syms x;
fimplicit3 syms x y; g(x)=piecewise(x<0,-1,x>=0,2);
fimplicit(y^2-x^2*(x+1),[-2 2]) g(3)
syms x y z;
fimplicit3(x^2*y*z+y^3-z^3) matlabFunction, Convert symbolic expression to a
matlabFunctionBlock, MATLAB callable function, Simulink
simscapeEquation block or Simscape equation.
g = matlabFunction(f)
© 2018 The MathWorks, Inc. MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See mathworks.com/trademarks for a list of
additional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders.
mathworks.com mathworks.com/products/symbolic.html
MATLAB: Quick Reference Sheet
Insert a new line or Code or Text Alt+Enter ones Create matrix of 1 values:
ones(3,5)
Toggle between Code and Text Ctrl+E
zeros Create matrix of 0 values:
Title Ctrl+Alt+L zeros(3,5)
Heading Ctrl+Alt+H parentheses, Index into matrix:
() x=[1,2;3,4]; x(2,1)
Section Break Ctrl+Alt+Enter
diag Diagonal elements of matrix:
Bulleted List Ctrl+Alt+U
x=[1,2;3,4]; diag(x)
Numbered List Ctrl+Alt+O times, .* Element by element multiplication:
Italic Ctrl+I x=[1,2;3,4]; y=[2,3;4,5]; x.*y
© 2018 The MathWorks, Inc. MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See mathworks.com/trademarks for a list of
additional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders.
mathworks.com mathworks.com/products/symbolic.html