Symbolic Math Toolbox – User’s Guide 2023
Symbolic Math Toolbox – User’s Guide 2023
MathWorks
ContentsSymbolic Computations in MATLAB
Find Symbolic Variables in Expressions, Functions, and Matrices 2-2
Find a Default Symbolic Variable . 2-2
Choose syms or sym Function 2-4
Change Output Format of Symbolic and Variable-Precision Arithmetic
2-8
Change Output Display Format of Symbolic Results in the Live Editor . 2-11
Add Subscripts, Superscripts, and Accents to Symbolic Variables in the
Live Editor 2-14
Copy and Paste Symbolic Output in Live Editor 2-18
Check Symbolic Equations, Inequalities, and Conditional Statements . 2-23
Numeric to Symbolic Conversion 2-29
Choose Numeric or Symbolic Arithmetic . 2-32
Double-Precision Arithmetic 2-32
Variable-Precision Arithmetic . 2-32
Symbolic Arithmetic 2-33
Comparisons of Numeric and Symbolic Arithmetic . 2-34
Increase Precision of Numeric Calculations . 2-36
Compute Binomial Coefficients Exactly . 2-38
Find Almost Integers with High-Precision Arithmetic . 2-41
Decimal Digits of PI 2-45
Units of Measurement Tutorial . 2-47
Unit Conversions and Unit Systems 2-53
Convert Units . 2-53
Temperature Unit Conversion . 2-54
Convert to SI, CGS, or US Unit Systems . 2-54
Define Custom Unit System from Existing System 2-56
Define Custom Unit System Directly 2-57
Unit System Definition 2-58
Units and Unit Systems List 2-60
Units List 2-60
SI Unit Prefixes List 2-70
Unit Systems List 2-71
Defining Constants of SI Units 2-72
Units in Physics Calculations . 2-74
vi ContentsThe Physics of the Damped Harmonic Oscillator . 2-78
Evaluating the Average Power Delivered by a Wind Turbine 2-88
Developing an Algorithm for Undistorting an Image 2-93
Electric Dipole Moment and Radiation Power . 2-99
Validate Simulink Model Using Symbolic Math Toolbox 2-102
Mathematics
3
Solve Algebraic Equations 3-3
Solve an Equation . 3-3
Return the Full Solution to an Equation 3-3
Work with the Full Solution, Parameters, and Conditions Returned by solve
3-4
Visualize and Plot Solutions Returned by solve . 3-5
Simplify Complicated Results and Improve Performance 3-6
Solve System of Algebraic Equations 3-7
Troubleshoot Equation Solutions from solve Function 3-17
Return Only Real Solutions . 3-17
Apply Simplification Rules . 3-17
Use Assumptions to Narrow Results 3-18
Simplify Solutions 3-19
Tips 3-19
Solve Equations Numerically . 3-21
Solve System of Linear Equations . 3-30
Solve System of Linear Equations Using linsolve . 3-30
Solve System of Linear Equations Using solve 3-31
Select Numeric or Symbolic Solver 3-33
Solve Parametric Equations in ReturnConditions Mode . 3-34
Solve Algebraic Equation Using Live Editor Task . 3-36
Solve Differential Equation . 3-43
First-Order Linear ODE . 3-43
Solve Differential Equation with Condition . 3-43
Nonlinear Differential Equation with Initial Condition . 3-44
Second-Order ODE with Initial Conditions . 3-44
Third-Order ODE with Initial Conditions . 3-44
More ODE Examples 3-45
Solve a System of Differential Equations 3-47
viiSolve a Second-Order Differential Equation Numerically 3-52
Solve Partial Differential Equation of Tsunami Model . 3-54
Solve Differential Algebraic Equations (DAEs) . 3-61
Solve Semilinear DAE System . 3-70
Solve DAEs Using Mass Matrix Solvers . 3-77
Step 1. Convert DAEs to Function Handles . 3-77
Step 2. Find Initial Conditions 3-78
Step 3. Solve DAE System . 3-79
Analyze and Manipulate Differential Algebraic Equations . 3-82
Derive and Apply Inverse Kinematics to Two-Link Robot Arm 3-89
Gauss-Laguerre Quadrature Evaluation Points and Weights 3-96
Simulate a Stochastic Process Using the Feynman–Kac Formula . 3-106
The Black–Scholes Formula for Call Option Price . 3-114
Choose Function to Rearrange Expression . 3-119
Combine Terms of Same Algebraic Structures . 3-119
Expand Expressions . 3-120
Factor Expressions 3-121
Extract Subexpressions from Expression . 3-123
Collect Terms with Same Powers . 3-123
Rewrite Expressions in Terms of Other Functions . 3-124
Compute Partial Fraction Decompositions of Expressions . 3-125
Compute Normal Forms of Rational Expressions 3-125
Represent Polynomials Using Horner Nested Forms . 3-126
Extract Numerators and Denominators of Rational Expressions . 3-127
Simplify Symbolic Expressions . 3-129
Simplify Using Options . 3-130
Simplify Using Assumptions . 3-132
Simplify Fractions 3-132
Simplify Symbolic Expressions Using Live Editor Task . 3-134
Substitute Variables in Symbolic Expressions 3-140
Substitute Elements in Symbolic Matrices . 3-142
Substitute Scalars with Matrices . 3-144
Evaluate Symbolic Expressions Using subs . 3-146
Abbreviate Common Terms in Long Expressions 3-147
Harmonic Analysis of Transfer Function Output 3-150
viii ContentsExplore Single-Period Asset Arbitrage 3-156
Analytical Solutions of the Inverse Kinematics of a Humanoid Robot 3-160
Differentiation 3-171
Derivatives of Expressions with Several Variables . 3-172
More Examples 3-173
Integration . 3-176
Integration with Real Parameters . 3-178
Integration with Complex Parameters 3-179
High-Precision Numerical Integration Using Variable-Precision Arithmetic
3-180
Taylor Series . 3-182
Fourier and Inverse Fourier Transforms . 3-184
Fourier Transform Definition 3-184
Concept: Using Symbolic Workflows . 3-184
Calculate Beam Deflection Using Fourier Transform . 3-184
Solve Differential Equations of RLC Circuit Using Laplace Transform 3-188
Solve Difference Equations Using Z-Transform 3-195
Symbolic Summation 3-200
Comparing symsum and sum 3-200
Computational Speed of symsum versus sum 3-200
Output Format Differences Between symsum and sum . 3-201
Padé Approximant . 3-202
Limits . 3-209
One-Sided Limits . 3-209
Find Asymptotes, Critical, and Inflection Points 3-212
Functional Derivatives Tutorial 3-217
Learn Calculus in the Live Editor . 3-222
Differentiation 3-227
Integration . 3-235
Interactive Calculus in Live Editor . 3-239
Maxima, Minima, and Inflection Points 3-241
Find Extremum of Multivariate Function and Its Approximation . 3-250
Padé Approximant of Time-Delay Input 3-254
Solve Partial Differential Equation of Nonlinear Heat Transfer 3-260
ixSymbolic Matrix Computation . 3-267
Linear Algebraic Operations . 3-274
Symbolic Hilbert Matrix 3-274
Symbolic Linear Algebra Operations . 3-274
Variable-Precision Arithmetic 3-275
Symbolic Investigation of Singular Value . 3-276
Basic Algebraic Operations . 3-278
Singular Value Decomposition . 3-280
Eigenvalues 3-282
Jordan Canonical Form . 3-286
Eigenvalues of the Laplace Operator 3-288
Hilbert Matrices and Their Inverses 3-298
Markov Chain Analysis and Stationary Distribution . 3-302
Matrix Rotations and Transformations 3-307
Clear Assumptions and Reset the Symbolic Engine 3-314
Check Assumptions Set on Variables . 3-315
Effects of Assumptions on Computations 3-316
Recognize and Avoid Round-Off Errors 3-317
Use Symbolic Computations When Possible . 3-317
Perform Calculations with Increased Precision . 3-317
Compare Symbolic and Numeric Results 3-319
Plot the Function or Expression 3-319
Increase Speed by Reducing Precision 3-321
Prime Factorizations . 3-323
Handling Large Integers to Solve the 196 Problem 3-326
Graphics
4
Create Plots of Symbolic Expressions . 4-2
Transform Spherical Coordinates to Cartesian Coordinates and Plot
Analytically 4-10
Tangent Plane and Normal Line of Implicit Surface 4-17
Analytical Plotting with Symbolic Math Toolbox . 4-21
x ContentsSimulate the Motion of the Periodic Swing of a Pendulum . 4-38
Animation and Solution of Double Pendulum Motion . 4-53
Animation and Model of Automotive Piston . 4-60
Code Generation
5
Generate C or Fortran Code from Symbolic Expressions 5-2
Generate MATLAB Functions from Symbolic Expressions . 5-3
Generating a Function Handle . 5-3
Control the Order of Variables . 5-3
Generate a File . 5-4
Name Output Variables . 5-5
Generate MATLAB Function Blocks from Symbolic Expressions . 5-6
Generate and Edit a Block 5-6
Control the Order of Input Ports 5-6
Name the Output Ports . 5-7
Generate Simscape Equations from Symbolic Expressions 5-8
Convert Algebraic and Differential Equations 5-8
Limitations 5-9
Deploy Generated MATLAB Functions from Symbolic Expressions with
MATLAB Compiler 5-10
Generate C Code from Symbolic Expressions Using the MATLAB Coder
App 5-16
Derive Quadrotor Dynamics for Nonlinear Model Predictive Control . 5-30
Using Symbolic Mathematics with Optimization Toolbox Solvers 5-37
Improving Accuracy and Performance in Optimization 5-46
Analytical Model of Cantilever Truss Structure for Simscape . 5-52
Customize and Extend Simscape Libraries for a Custom DC Motor 5-60
Estimate Model Parameters of a Symbolically Derived Plant Model in
Simulink 5-69
xiMuPAD to MATLAB Migration
6
MuPAD Engines and MATLAB Workspace 6-2
Convert MuPAD Notebooks to MATLAB Live Scripts . 6-3
Convert a MuPAD Notebook .mn to a MATLAB Live Script .mlx . 6-3
Convert MuPAD Graphics to MATLAB Graphics 6-4
Known Issues 6-4
Troubleshoot MuPAD to MATLAB Translation Errors . 6-8
Troubleshoot MuPAD to MATLAB Translation Warnings . 6-15
Differences Between MATLAB and MuPAD Syntax 6-20
Call Built-In MuPAD Functions from MATLAB . 6-22
evalin . 6-22
feval 6-22
evalin vs. feval 6-23
Floating-Point Arguments of evalin and feval . 6-23
Functions
كلمة سر فك الضغط : books-world.net
The Unzip Password : books-world.net
تعليقات