Download presentation
Presentation is loading. Please wait.
Published byMacey Sorrels Modified over 10 years ago
1
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege.edu Engr/Math/Physics 25 Chp11: MuPAD
2
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 2 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Learning Goals Understand and Open MuPAD “NoteBooks” Work within the NoteBooks to perform SYMBOLIC CALCULATIONS including Algebra Transcendental Equations Calculus Ordinary Differential Equations
3
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 3 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Chapter Sections NOT Covered §4 → Matrix Operations §7 → LaPlace Transforms §8 → Special Functions Carefully Study the Book for Syntax Learn MuPAD by –“Stare & Compare” (examples) –Hacking –And, if all else fails, then HELP!
4
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 4 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Learning Goals Use MuPAD to create PLOTS of functions
5
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 5 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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
6
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 6 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods MuPAD → SYMBOLIC Calcs MuPAD, sort of Like SimuLink, is a program within-a Program SimuLink creates Icon-based “Models” (.mdl) of Mathematical Systems –SimuLink produces NUMERICAL Resuls 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
7
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 7 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Symbolic Computation The Differences Between Symbolic and Numeric Computation NumericalSymbolic 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 Symbolic computations are not similar to standard programming languages – they use symbolic Manipulations
8
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 8 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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
9
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 9 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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.
10
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 10 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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.
11
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 11 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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 beginers it’s best start at the MuPAD “Welcome” screen At the MATLAB Command Prompt type mupadwelcome
12
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 12 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods mupadwelcome Screen Suggest Spending Some time in the “Getting Started” section
13
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 13 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Go Directly to WorkBook In MATLAB command window type mupad A MuPAD NoteBook
14
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 14 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods NoteBook Regions Calcs CALC Regions
15
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 15 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods NoteBook Regions Text TEXT Regions
16
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 16 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods NoteBook Regions OutPut OutPut Regions
17
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 17 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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
18
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 18 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Evaluate by TOOL Place the cursor IN the CALC Region Then Hit the Evaluate Button to initiate the Calculation Note also the ASSIGNMENT Operator → After EVALUATE :=
19
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 19 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Evaluate Options Use the Pull- Down Menu for Different forms of the EVALUATION Use the NOTEBOOK Pull-Down “Evalute All” works well
20
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 20 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods MuPAD Syntax & Structure TEXT regions do NOT have a left Bracket CALC & OUTPUT Regions DO have a Left Bracket Interaction with INTEGERS Produces a SYMBOLIC OutPut Using a decimal Point Produces a NUMBER Result
21
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 21 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods MuPAD Syntax & Structure Reserved Symbols The Logarithms Log Examples A Decimal
22
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 22 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods FLOAT command The float command produces a DECIMAL Result for an otherwise integer display Caveat on float(%) The float(%) command changes the LAST EVALUATED result to a decimal; not necessarily the value right above (or below) the float(%) command
23
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 23 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Float(%) Confusion Bottom Expression Evaluated LAST First Expression Edited then Eval’d
24
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 24 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Command Bar ShortCuts to Commands in: Items on the Command Bar use # as a PlaceHolder that MUST be replaced
25
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 25 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Expression vs. Function An EXPRESSION Example A MuPAD Function is called a Procedure Construction looks like an anonymous fcn –Use “ -> ” in place of @
26
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 26 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Plots are Easy Plot from a Procedure (UDF) Plot from an Expression No SemiColon
27
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 27 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Printing from MuPAD Each NoteBook must be Printed Separately Use standard Windows Pull-Down Menu: File → Print These should appear in all Notebks Student Name ENGR25 HW Problem Number Date Created/Printed
28
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 28 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Copy-n-Paste in MuPAD The TEXT regions can be copied & pasted in the normal fashion In MSWord The BLUE “Hand Math” must be copied and “Pasted Special” as a “Device Independent Bitmap” In PPT A Plain “Bitmap” Paste- Special also works Examples of the two Bitmaps into PPT shown below
29
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 29 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Copy-n-Paste in MuPAD Pasting in MSWord requires TWO Copy-n-Paste Operations 1.Paste TEXT Regions NORMALLY 2.Paste “Script Math” Using “Paste Special”
30
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 30 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Copy-n-Paste in MuPAD Copying GRAPHS requires at THIRD Operation Make the Graph Click the Graph to Activate the Plot Menu Bar
31
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 31 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Copy-n-Paste in MuPAD Use Pull-Down Menu The Thick border indicates graphic has been copied to the clipboard
32
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 32 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Copy-n-Paste in MuPAD Then NORMAL Paste into Word
33
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 33 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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
34
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 34 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
35
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 35 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Example Algebra Given Expressions 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
36
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 36 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Algebra Example
37
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 37 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Solving Equation solve(eqn) SOLVE in here
38
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 38 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Solve Systems of Eqns Solve by MuPAD and Note the use of SQUARE Brackets
39
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 39 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods solve::numeric Some eqns do NOT have Algebraic solution, such as Solve by regular MATLAB → fzero Use fplot for Solutions ≈ x = ±2.76 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
40
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 40 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods solve::numeric Chk with MuPAD Now use numeric modifier in MuPAD No Symbol Soln Only ONE Solution LEFT Solution RIGHT Solution
41
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 41 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Formatting Plots Make a plot, then click the plot to CHANGE the tool Bar Click the “Object Browser” Button Explore the options in the two boxes at right (click upper item first)
42
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 42 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods After some menu Exploration
43
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 43 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods EXPORT Graphs RIGHT Click the Graphic, then Follow the “Wizard” instructions
44
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 44 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Graph Export (JPEG) Result
45
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 45 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Derivatives diff(f,x)
46
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 46 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Example diff at a value A chance to use the subs command Given: Find by MuPAD
47
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 47 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Integrals int(f,x)
48
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 48 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods ODEs solve(ode(#, #(#)))
49
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 49 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Example assume Solve this ODE With Boundary Conditions With Constraint The assume command notifies MuPAD about the Constraint
50
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 50 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods All Done for Today MuPAD used to be Free A 523 Page MuPAD Tutorial http://www.calvin.edu/~tmk5/research/mupad_tutorial.pdf
51
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 51 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege.edu Engr/Math/Physics 25 Appendix
52
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-2.ppt 52 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Tutorial on Plot Formating Use ENGR25_MuPAD_t utorial_format_plot_ 1111.mn Solve Make Graph Format with OBJECT BROWSER tool
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.