Presentation is loading. Please wait.

Presentation is loading. Please wait.

ENGR-25_Lec-25_SimuLink-2.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.

Similar presentations


Presentation on theme: "ENGR-25_Lec-25_SimuLink-2.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical."— Presentation transcript:

1 ENGR-25_Lec-25_SimuLink-2.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical & Mechanical Engineer Engr/Math/Physics 25 Chp11: MuPAD

2 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 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 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 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 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 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 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 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 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 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 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 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 ENGR-25_Lec-25_SimuLink-2.ppt 14 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods NoteBook Regions  Calcs CALC Regions

15 ENGR-25_Lec-25_SimuLink-2.ppt 15 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods NoteBook Regions  Text TEXT Regions

16 ENGR-25_Lec-25_SimuLink-2.ppt 16 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods NoteBook Regions  OutPut OutPut Regions

17 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 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 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 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 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 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 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 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 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

26 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 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 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 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 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 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 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 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 ENGR-25_Lec-25_SimuLink-2.ppt 34 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

35 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 ENGR-25_Lec-25_SimuLink-2.ppt 36 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Algebra Example

37 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 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 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.^ *cos(x); fplot(ParabCos,[-5 5]), grid sL = fzero(ParabCos, -3) sR = fzero(ParabCos, +3) RESULT: sL = sR =

40 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 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 ENGR-25_Lec-25_SimuLink-2.ppt 42 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods After some menu Exploration

43 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 ENGR-25_Lec-25_SimuLink-2.ppt 44 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Graph Export (JPEG) Result

45 ENGR-25_Lec-25_SimuLink-2.ppt 45 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Derivatives  diff(f,x)

46 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 ENGR-25_Lec-25_SimuLink-2.ppt 47 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Integrals  int(f,x)

48 ENGR-25_Lec-25_SimuLink-2.ppt 48 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods ODEs  solve(ode(#, #(#)))

49 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 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

51 ENGR-25_Lec-25_SimuLink-2.ppt 51 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical & Mechanical Engineer Engr/Math/Physics 25 Appendix

52 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


Download ppt "ENGR-25_Lec-25_SimuLink-2.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical."

Similar presentations


Ads by Google