MuPAD Chp11: Engr/Math/Physics 25 Bruce Mayer, PE

advertisement
Engr/Math/Physics 25
Chp11:
MuPAD
Bruce Mayer, PE
Licensed Electrical & Mechanical Engineer
BMayer@ChabotCollege.edu
Engineering/Math/Physics 25: Computational Methods
1
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Learning Goals
 Understand and Open MuPAD
“NoteBooks”
 Work within the NoteBooks to perform
SYMBOLIC CALCULATIONS including
• Algebra
• Transcendental Equations
• Calculus
• Linear Algebra
• ODE’s
Engineering/Math/Physics 25: Computational Methods
2
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Chapter Sections NOT Covered
 §7 → LaPlace Transforms
 §8 → Special Functions
 Carefully Study the Book for Syntax
• Learn MuPAD by
– “Stare & Compare” (examples)
– Hacking
– Test Your Understanding (TYU) Exercises
– And, if all else fails, then HELP!
Engineering/Math/Physics 25: Computational Methods
3
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Learning Goals
 Use MuPAD
to create
PLOTS of
functions
 Looks more
like a puremath plot with
labels &
arrows only at
“correct” ends
Engineering/Math/Physics 25: Computational Methods
4
Mr. Batchelor would like this!
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Engineering/Math/Physics 25: Computational Methods
5
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
MATLAB Symbolic MATH
 In Addition to Using NUMBERS
MATLAB can Manipulate SYMBOLS
 Basically, a Mathematics HandBook has
been codifed in Software by a group at
the University of Paderborn in Germany
 The MathWORKS Purchased The
“MuPAD” Symbolic Math “Engine” (or
“Kernal”), and Integrated it into MATLAB
• MuPAD uses Pascal-like Syntax
Engineering/Math/Physics 25: Computational Methods
6
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
MuPAD → SYMBOLIC Calcs
 MuPAD, sort of Like SimuLink, is a
Program-within-a-Program
• SimuLink creates Icon-based “Models” (.slx)
of Mathematical Systems
– SimuLink produces NUMERICAL Results
 MuPAD creates “NoteBooks” (.mn) in
which SYMBOLIC quantities can be used
• The Symbols can be associated with NO
particular number value
– It’s similar to a Math Book that does the work
Engineering/Math/Physics 25: Computational Methods
7
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Symbolic Computation
 The Differences Between Symbolic and
Numeric Computation
Numerical
Variables Represent
Numbers
Variables are Symbols; e.g., x,
y, z, β, θ, σ
Answers can Only be
Numbers
Answers can contain Variables
and Functions
Numeric Computation
can be done using
Standard Programming
Languages
Engineering/Math/Physics 25: Computational Methods
8
Symbolic
Symbolic computations are not
similar to standard programming
languages – they use symbolic
Manipulations
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
MuPAD BackGround
 MuPAD is a part a generic class of
Software called a “Computer
Algebra System” (CAS).
• MuPAD research group at the University of
Paderborn, Germany originally developed
this symbolic-manipulation software
 The MathWORKS purchased MuPAD to
replace the previous “Symbolic Math
Kernal” written by MapleSoft
Engineering/Math/Physics 25: Computational Methods
9
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Sample of MuPAD Capabilities
 Create SYMBOLIC expressions and
manipulate them algebraically.
 Obtain SYMBOLIC and numeric
solutions to algebraic and
transcendental equations.
 Perform SYMBOLIC LINEAR
ALGEBRA operations, including
obtaining expressions for determinants,
matrix inverses, and others.
Engineering/Math/Physics 25: Computational Methods
10
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Sample of MuPAD Capabilities
 Perform SYMBOLIC differentiation
and integration
 Evaluate limits and series
SYMBOLICALLY.
 Obtain SYMBOLIC solutions to Ordinary
Differential Equations (ODEs).
 Solve ORDINARY DIFFERENTIAL
EQUATIONS in terms of special
functions or series.
Engineering/Math/Physics 25: Computational Methods
11
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
MuPAD “NoteBook”
 MuPAD creates within MATLAB its own
working SubWindows Called NoteBooks
• The User works/types in the “NoteBooks”
• NoteBooks saved with extension: .mn
 For MuPAD beginners it’s best start at
the MuPAD “Welcome” screen
 At the MATLAB Command Prompt type
mupadwelcome
Engineering/Math/Physics 25: Computational Methods
12
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
mupadwelcome Screen
 Suggest Spending Some time in the
“Getting Started” section
Engineering/Math/Physics 25: Computational Methods
13
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Go Directly to WorkBook
 In MATLAB
command
window type
mupad
 Or Find The
MuPAD Icon
on the
“Apps” Tab
Engineering/Math/Physics 25: Computational Methods
14
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
The MuPAD WorkBook Screen
 Caveat (Beware)!
• When the Command Bar
produces a “template
command” you may see several
“Hash Marks”; #
• # is just a PLACE HOLDER that
MUST be REPLACED with
something meaningful to
MuPAD!
 The Command Bar has many useful
Templates and characters
Engineering/Math/Physics 25: Computational Methods
15
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Anatomy of the MuPAD Screen
A → Perform most
common tasks from the
Standard toolbar.
B → Type your comments
in the text regions.
C → Enter commands in
the input regions.



D → View results
(including graphics) in the
output regions.
E → A new input region
appears after evaluation of
the bottom input region.


F → View current status
information in the Status
bar.

Engineering/Math/Physics 25: Computational Methods
16
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Anatomy of the MuPAD Screen
G → Find and Replace
text in the input and text
regions.
H → Quickly access
standard functions from
the Command Bar.
I → Format NonGraphical
objects in the input and
output regions from the
Format toolbar.
J → Use more items from
the toolbars.
K → Menus change in
the Graphics Format
mode.





Engineering/Math/Physics 25: Computational Methods
17
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
NoteBook Regions Calcs
CALC Regions
Engineering/Math/Physics 25: Computational Methods
18
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
NoteBook Regions Text
TEXT Regions
Engineering/Math/Physics 25: Computational Methods
19
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
NoteBook Regions OutPut
OutPut Regions
Engineering/Math/Physics 25: Computational Methods
20
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
If Command Bar NOT Shown
 Find Command Bar in VIEW Menu
Engineering/Math/Physics 25: Computational Methods
21
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Importance of “Evaluation”
 The CALCULATION regions in MuPAD
can be Inserted, Deleted, Edited
 After Editing, We may have to
EVALUATE the edit using the TOOL or
PULL DOWN MENU
 If a change in an OUTPUT Region does
NOT happen as expected; then be
SURE to EVALUATE the CALC region
• “EVALUATE ALL” often works best
Engineering/Math/Physics 25: Computational Methods
22
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Evaluate by TOOL
 Place the cursor
IN the CALC
Region
 Then Hit the
Evaluate Button
to initiate the
Calculation
 Note also the
ASSIGNMENT
Operator →
:=
Engineering/Math/Physics 25: Computational Methods
23
After EVALUATE
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Evaluate Options
 Use the PullDown Menu for
Different forms of
the
EVALUATION
 Use the
NOTEBOOK
Pull-Down
• “Evaulute All”
works well
Engineering/Math/Physics 25: Computational Methods
24
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
MuPAD Syntax & Structure
 TEXT regions do
NOT have a left
Bracket
 CALC & OUTPUT
Regions DO have a
Left Bracket
Engineering/Math/Physics 25: Computational Methods
25
 Interaction with
INTEGERS
Produces a
SYMBOLIC OutPut
 Using a decimal
Point Produces a
NUMBER Result
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
MuPAD Syntax & Structure
 Reserved Symbols
 Log Examples

 PI
e
 E
i  j  1  I
 The Logarithms
log b
ln
 Base - b log
 Base - e log
Engineering/Math/Physics 25: Computational Methods
26
A Decimal
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
FLOAT command
 The float
command produces
a DECIMAL Result
for an otherwise
integer display
Engineering/Math/Physics 25: Computational Methods
27
 Caveat on float(%)
 The float(%)
command changes
the LAST
EVALUATED result
to a decimal; not
necessarily the value
right above (or below)
the float(%)
comman
• Use float(x) to
obtain theBruce
Decimal
x
Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Float(%) Confusion
 Bottom Expression
Evaluated LAST
Engineering/Math/Physics 25: Computational Methods
28
 First Expression
Edited then Eval’d
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Command Bar
 ShortCuts to
Commands in:
The General Math Menu
Expand
Simplify
Factor
Combine
Normalize
Rewrite
Evaluate
Solve
Items on the Command bar
Derivatives
Integrals
Solve Equations
Numerical Evaluation and Rounding
Math Operators
Trig Functions
Reserved Symbols
Matrices and Vectors
Limits
Rewrite Expressions
Simplify
Equality Tests
Factorials
Exponentials and Logs
Greek Letters
2D Plot
Sums
Products
Evaluate with x = a
Assignment
Function Definition
Piecewise Definitions
Physical Units
3D Plot
 Items on the
Command Bar use
# as a PlaceHolder
that MUST be
replaced
Engineering/Math/Physics 25: Computational Methods
29
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Expression vs. Function
 An EXPRESSION
Example
 A MuPAD Function is
called a Procedure
• Construction looks like
an anonymous fcn
– Use “->” in place of @
Engineering/Math/Physics 25: Computational Methods
30
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Plots are Easy
 Plot from a
Procedure (UDF)
 Plot from an
Expression
No SemiColon
Engineering/Math/Physics 25: Computational Methods
31
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Printing from MuPAD
 Each NoteBook must
be Printed Separately
 Use standard Windows
Pull-Down Menu:
• File → Print
 These should appear in
all NoteBooks
• Student Name
• ENGR25
• HW Problem Number
• Date Created/Printed
Engineering/Math/Physics 25: Computational Methods
32
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Copy MuPAD Symbolic Math
 A MuPAD WorkBook
Engineering/Math/Physics 25: Computational Methods
33
 Select Content
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Copy MuPAD Symbolic Math
 In MSWord use:
• PASTE SPECIAL
• FORMATED TEXT
(RTF)
Engineering/Math/Physics 25: Computational Methods
34
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Copied MuPAD WorkBook
Engineering/Math/Physics 25: Computational Methods
35
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Copy-n-Paste MuPAD Plots
 Copying GRAPHS
requires a new
Operation
 Click the Graph to
Activate the Plot
Menu Bar
 Make the Graph
Engineering/Math/Physics 25: Computational Methods
36
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Copy-n-Paste in MuPAD
 Use Pull-Down
Menu
Engineering/Math/Physics 25: Computational Methods
37
 The Thick border
indicates graphic
has been copied to
the clipboard
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Copy-n-Paste in MuPAD
 Then NORMAL Paste into Word
Engineering/Math/Physics 25: Computational Methods
38
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Copy-n-Paste in MuPAD
 To AVOID All this Copy-n-Paste Hassle
• Simplest is to just PRINT the MuPAD
NoteBook
– Only get one Problem per sheet
• Do an alt+PrtScrn to copy the MuPAD
window, then paste the whole window into
MSWord
• Do an entire SCREEN-SHOT and crop it
back to the MuPAD part
– If MuPAD window not maximized
Engineering/Math/Physics 25: Computational Methods
39
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
SelectAll-n-Copy
Engineering/Math/Physics 25: Computational Methods
40
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Paste SelectAll in MSWord
Engineering/Math/Physics 25: Computational Methods
41
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
MuPAD → PDF → MSWord
 This is a Cluge, but it works
Engineering/Math/Physics 25: Computational Methods
42
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
MuPAD → PDF → MSWord
 Locate & Open the Just Created PDF
file
Engineering/Math/Physics 25: Computational Methods
43
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
MuPAD → PDF → MSWord
 Select the
MuPAD content
using the PDF
“SnapShot” tool
Engineering/Math/Physics 25: Computational Methods
44
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
MuPAD → PDF → MSWord
Engineering/Math/Physics 25: Computational Methods
45
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
MuPAD → PDF → MSWord
 Finally into MSWord
Engineering/Math/Physics 25: Computational Methods
46
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Engineering/Math/Physics 25: Computational Methods
47
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Example  Algebra
 Given Expressions
A  y  15 y  75 y
3
2
B   y  5  20 y
2
 For This situation find
• The Product A∙B in Simplest Form
• The Quotient A/B in Simplest Form
• Evaluate A+B at y = 8.3 in
– Symbolic form
– Numeric form
Engineering/Math/Physics 25: Computational Methods
48
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Algebra Example
Engineering/Math/Physics 25: Computational Methods
49
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Solving Equation  solve(eqn)
SOLVE
in here
Engineering/Math/Physics 25: Computational Methods
50
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Solve Systems of Eqns
 Solve by MuPAD
1x
1x
1x



1y
1y
2y



2z
3z
1z



11
14
5
1
2
3



3z
z
z



17
0
6
1
2
3
 Note the use of
SQUARE Brackets
 and
2x
x
4x



4y
2y
y
Engineering/Math/Physics 25: Computational Methods
51
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
10
solve::numeric
5
X: -2.76
Y: 0.1141
X: 2.76
Y: 0.1141
0
 Some eqns do NOT
have Algebraic
solution, such as
x 2  14  7 cosx 
-5
-10
-15
-20
Solutions ≈ x = ±2.76
-25
-5
 Solve by regular
MATLAB → fzero
 Use fplot for
x  14  7 cosx   0
2
Engineering/Math/Physics 25: Computational Methods
52
-4
-3
-2
-1
0
1
2
3
4
5
ParabCos = @(x) x.^2-14 - 7*cos(x);
fplot(ParabCos,[-5 5]), grid
sL = fzero(ParabCos, -3)
sR = fzero(ParabCos, +3)
RESULT:
sL =
-2.7460
sR =
2.7460
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
solve::numeric
 Now use numeric
modifier in MuPAD
 Chk with MuPAD
Default Plot RANGE is ±𝝅
No Symbol Soln
Only ONE Solution
LEFT Solution
Engineering/Math/Physics 25: Computational Methods
53
RIGHT Solution
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Access SolutionSet Values
 The solutions
enclosed in
Braces
{ } are NOT
available for
Other uses
 Access by
Sq-Bracket
Array Index: [n]
Engineering/Math/Physics 25: Computational Methods
54
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Solution
Set
Access
Fine
Point
Need this x
at the End
Engineering/Math/Physics 25: Computational Methods
55
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Formatting Plots
 Make a plot, then
click the plot to
CHANGE the
Tool-Bar
Engineering/Math/Physics 25: Computational Methods
56
 Click the “Object
Browser” Button
 Explore the options
in the two boxes at
right (click upper
item first)
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
After some menu Exploration
Engineering/Math/Physics 25: Computational Methods
57
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
EXPORT Graphs
 RIGHT Click the Graphic, then Follow
the “Wizard” instructions
Engineering/Math/Physics 25: Computational Methods
58
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Graph Export (JPEG) Result
Engineering/Math/Physics 25: Computational Methods
59
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Linear Algebra (Matrices)
 Recall 3x3 Array in
MATLAB
>> AML = [5 -7 -9;
4 8 -3; -1 5 9]
AML =
5
-7
-9
4
8
-3
-1
5
9
 MuPAD Requires a
few more Brackets
Engineering/Math/Physics 25: Computational Methods
60
Amp:=
matrix([[3,5,-7],
-4,-2,9],[8,1,7]])
 Note Enclosure in
Large Parens
 Std Notation is
Large SQ brackets
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Linear Algebra (Matrices)
 BOOBY TRAP →
Scalar Addition
 In MATLAB the
Scalar is Added to
EVERY Element
>> AMLp7 = AML + 7
AMLp7 =
12
11
6
0
15
12
AmpP7:= Amp +7
-2
4
16
Engineering/Math/Physics 25: Computational Methods
61
 In MuPAD Scalar
Addition affects
ONLY the
DIAGONAL
Elements
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Linear Algebra (Matrices)
 In BOTH MATLAD & MuPAD 𝑚x𝑛
Arrays DO add Term by Term
>> AML_mxm = AML +
AMLp7
Amp_mxm := Amp + AmpP7
AML_mxm =
17
15
5
-7
23
17
-11
1
25
Engineering/Math/Physics 25: Computational Methods
62
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Linear Algebra (Matrices)
 In MuPAD Matrices
can be
• Purely Numerical
– See previous
Example
• Numerical &
Symbolic
An_m_s :=
matrix([[3,u,7],[v/u,w,9],[8,2*w,cos(v)]])
Engineering/Math/Physics 25: Computational Methods
63
• Purely Symbolic
An_m_s := matrix([[3,u,7],[v/u,w,9],[8,2*w,cos(v)]])
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Linear Algebra (Matrices)
 Inverting Symbolic Matrices can be
VERY Painful
• All integers→
AmpInv := inverse(Amp)
• All Symbolic →
ApsInv := inverse(Aps)
Engineering/Math/Physics 25: Computational Methods
64
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Linear Algebra (Matrices)
 Solve System of Eqns → 𝐀𝑥 = 𝑏
 Solve for 𝑥 in Eqn Set:
𝟐𝒙 + 𝒂𝒚 = 𝟏
where 𝒂 is a constant
𝟑𝒙 − 𝟔𝒚 = 𝟑
 SolveBy
• inverse
• matlinsolve
Engineering/Math/Physics 25: Computational Methods
65
Same Result
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Derivatives  diff(f,x)
Engineering/Math/Physics 25: Computational Methods
66
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Higher Order Diff by $
Engineering/Math/Physics 25: Computational Methods
67
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Example  diff at a value
 A chance to use the
subs command
 Given:
u  cosh 5v   sinh(3v)
 Find by MuPAD
du
dv v 0.3
Engineering/Math/Physics 25: Computational Methods
68
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Integrals 
int(f,x)
Engineering/Math/Physics 25: Computational Methods
69
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
ODEs  solve(ode(#, #(#)))
Engineering/Math/Physics 25: Computational Methods
70
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Example  assume
 Solve this ODE
d2y
 ky  0
2
dx
 The assume
command notifies
MuPAD about the
Constraint
 With Boundary
Conditions
y 0   1
dy
dx x 0  0
 With Constraint
k 0
Engineering/Math/Physics 25: Computational Methods
71
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Numerical Integ: Strip-Count




y  e x sin 8x 2 3  1
y  e x sin 8x 2 3  1
Engineering/Math/Physics 25: Computational Methods
72
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Tutorial on Plot Formating
 Use
ENGR25_MuPAD_t
utorial_format_plot_
1305.mn
 Solve & Make
Graph
 Format with
OBJECT
BROWSER tool
Engineering/Math/Physics 25: Computational Methods
73
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
All Done for Today
MuPAD
used to
be Free
A 523 Page MuPAD Tutorial
http://www.calvin.edu/~tmk5/research/mupad_tutorial.pdf
Engineering/Math/Physics 25: Computational Methods
74
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Engr/Math/Physics 25
Appendix
f x   2 x  7 x  9 x  6
3

2

5 y  3 y  7 y  f t 
Bruce Mayer, PE
Licensed Electrical & Mechanical Engineer
BMayer@ChabotCollege.edu
Engineering/Math/Physics 25: Computational Methods
75
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_Lec-25_SimuLink-2.ppt
Download