Presentation is loading. Please wait.

Presentation is loading. Please wait.

Your objective: to dominate! My objective: to help you dominate!

Similar presentations


Presentation on theme: "Your objective: to dominate! My objective: to help you dominate!"— Presentation transcript:

1 Your objective: to dominate! My objective: to help you dominate!
Matlab® refresher Your objective: to dominate! My objective: to help you dominate!

2 Some references MATLAB Student Version: Learning MATLAB, The MathWorks, Inc. Introduction to MATLAB 6 for Engineers, W.J.Palm III, McGraw-Hill. Numerical Methods with MATLAB, G.Recktenwald, Prentice Hall.

3 Key concept: the Workspace (WS)
The Workspace (WS) contains all of your currently active variables and relations. These are initially entered by typing commands (most likely). Useful Workspace commands: Clear : empty the WS Who (whos) : show what is in the WS Save <filename>: save all WS variables to file Load <filename>: retrieve a particular WS from file

4 Key concept: WS inputs WORKSPACE Command line inputs
Script file inputs Workspace file inputs

5 Key concept: WS outputs
Diary files WORKSPACE Workspace files Graphics (plot) files

6 Script files Script files are text files that are created using the MATLAB script file editor. They usually have the suffix .m. A script file can be run from the command line or toolbar. Two items to remember about .m files: Use “%” to enter comments for your use. Use “;” at the end of lines to suppress echo printing when the file is run.

7 More about the Workspace
Recording your MATLAB session can be useful for documentation. Useful Workspace commands: Diary <filename> : turn on recording of all text i/o except plots, save into <filename> Diary off : turn off current recording Path : pointer to current directory Pathtool : directory browser

8 A typical session pattern
Clear Diary Problem1 { create data etc here …} Pa= 14.7; R= 245.6; P= 23; Q = (1/R)*(P-Pa); who Save Problem1Run1 Diary off You now have 2 files: Problem1: a diary of this session Problem1Run1: a WS file that can be used to recover your last state by using a Load command

9 Solving Linear Algebraic Equations
Define a set of linear algebraic equations as follows: A*X = B*U X is the unknown vector (n x 1) U is the input vector (m x 1) A is n x n, B is n x m In the WS define A, B, and U. Then type X= inv(A)*B*U Click here to see an example session: LAExample1

10 Solving Linear Algebraic Equations
Dominators know that a unique solution to a problem in linear algebra doesn’t always exist. To investigate before you leap try this: Use the command det(A) to check the determinant of A. Proceed accordingly. Sometimes we seek insight in the form of eigenvalues of A. Try this: Type Evals= eig(A). Click here to see an example session: LAExample2

11 Solving Linear Differential State Equations
Define a set of linear algebraic equations: Xdot = A*X + B*U Xdot is the first derivative of X. Create a script (.m) file that defines the equations for MATLAB in a specific format. for example: LDEEqns1.m Create a script file that controls the solving of the problem. click to see an example: LDEExample.pdf


Download ppt "Your objective: to dominate! My objective: to help you dominate!"

Similar presentations


Ads by Google