0% found this document useful (0 votes)
429 views

Symbolic Math Toolbox: Quick Reference Sheet: Algebra Calculus

This document provides a quick reference sheet for MATLAB's Symbolic Math Toolbox. It lists common symbolic algebra, calculus, and graphics functions. These include tools for symbolic substitution, differentiation, integration, solving equations, simplifying expressions, and plotting functions. The toolbox allows symbolic representation and manipulation of mathematical expressions.

Uploaded by

mykhailo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
429 views

Symbolic Math Toolbox: Quick Reference Sheet: Algebra Calculus

This document provides a quick reference sheet for MATLAB's Symbolic Math Toolbox. It lists common symbolic algebra, calculus, and graphics functions. These include tools for symbolic substitution, differentiation, integration, solving equations, simplifying expressions, and plotting functions. The toolbox allows symbolic representation and manipulation of mathematical expressions.

Uploaded by

mykhailo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Symbolic Math Toolbox: Quick Reference Sheet

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)

simplify Algebraic simplification: series Puiseux series expansion:


syms x; syms x; series(1/sin(x), x)
simplify(sin(x)^2 + cos(x)^2) taylor Taylor series:
isolate Isolate variable or expression in equation: syms x; taylor(exp(-x))
syms a b c x; isolate(a*x^2+b*x+c==0,x) gradient Gradient vector of scalar function:
lhs Left side (LHS) of equation: syms x y z;
syms x y; lhs(x^2 >= y^2) gradient(x*y + 2*z*x, [x, y, z])

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

Live Editor Matrix Operations


colon, : Create a row vector:
Command Keyboard Shortcut 1:10; 1:2:10
Move Up One Section Ctrl+upArrow linspace Linearly spaced points between endpoints:
Linspace(1,3,1000)
Move Down One Section Ctrl+downArrow
square Matrix construction and concatenation:
Run Section Ctrl+Enter
brackets, [] [1,2;3,4]
Run Section and Advance Ctrl+Shift+Enter NaN Create matrix of NaN values:
Run All Sections F5 NaN(3,5)

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

Bold Ctrl+B rdivide, ./ Element by element division:


x=[1,2;3,4]; y=[2,3;4,5]; x./y
Monospace Ctrl+M
plus, + Element by element addition:
Underline Ctrl+U x=[1,2;3,4]; y=[2,3;4,5]; x+y
LaTeX Equation Ctrl+Alt+G minus, - Element by element subtraction:
Hyperlink Ctrl+K x=[1,2;3,4]; y=[2,3;4,5]; x-y
gt, > Determine greater than:
x=[1,3;4,2]; x>2
inv Invert a matrix:
X=[1,2;3,4]; inv(x)
Cells & Tables
size Size of a matrix:
cell Create a cell array: x=[1,2,3;4,5,6]; size(x)
cell(3,5)
eye Create identity matrix:
curly Access specific cell in cell array: eye(3,4)
brackets, {} c = cell(3,5); c{3,5}
isnan Find elements that are NaN:
cell2mat Transform cell to matrix: x=[1,NaN;NaN,4]; isnan(x)
c = cell(3,5); cell2mat(c)
repmat Repeat copies of a matrix:
cellfun Apply function to each cell: x=diag([100 200 300]); repmat(x,2)
c = cell(3,5); cellfun(@mean,c)
bsxfun Element wise operation on two matrices:
table Create a table from given variables: x=[1,2;3,4]; bsxfun(@minus,x,mean(x))
table([1:2]',{'one';'two'})
arrayfun Apply function to each element:
cell2table Transform a cell array to a table: x=[1;3]; arrayfun(@(x) plus(x,x), x)
c=cell(3,5); cell2table(c)
table2array Transform a table into an array:
t=table([1:3]'); table2array(t) Full MATLAB cheat sheet

© 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

You might also like