Download presentation
Presentation is loading. Please wait.
Published byTeresa Price Modified over 9 years ago
1
Introduction to MATLAB 7 MATLAB Programming for Engineer Hassan Migdadi Spring 2013
2
MATLAB Properties I MATLAB is a very powerful mathematical computational tool. MATLAB comes from MATrix LABoratory MATLAB provides extensive capabilities for generating graphs MATLAB is applicable to a broad range of engineering problems
3
MATLAB Properties II MATLAB supports an interactive and a programming environment Think of the interactive environment as a “super calculator” with graphics Think of the programming environment as tool for writing programs to perform complex calculations
4
MATLAB Properties III Where does MATLAB fit? –It is usually easier to write programs in MATLAB as compared to C or Fortran –C or Fortran programs will usually run faster than MATLAB programs –But, MATLAB is optimized for matrix manipulations and programs formalized in this way will run faster than similar programs in C or Fortran
5
Course of Study MATLAB EnvironmentChp. 2 Built-In MATLAB Functions Chp. 3 Manipulating MATLAB MatricesChp. 4 PlottingChp. 5 User Defined FunctionsChp. 6 User Controlled Input and OutputChp. 7 Logical Functions and Control StructuresChp. 8 Matrix AlgebraChp. 9 Symbolic MathematicsChp. 11 Polynomials/Curve FittingChp. 12
6
Assignments The percent symbol % is used to define a comment, use this following the MATLAB prompt to add your name and assignment number to your work >>% Hassan Migdadi >>% Assignment 1
7
Assignments Many assignment require you to print the Edit window, the Command Window and the Figure window(s). Just print them all and staple them together when you turn them in. Remember to clear the command window before your final run to start with a clean slate.
8
More on Assignments The first few assignments can easily be done with paper and pencil and a calculator but you need to do them using MATLAB. Only outputs from MATLAB will be accepted.
9
An Engineering Problem-Solving Methodology Step 1: State the problem clearly. Step 2: Describe the inputs and outputs. Step 3: Work the problem by hand with a set of simple data. Step 4: Develop the MATLAB solution Step 5: Test the solution with real data
10
Getting Started Example 1 d = ½ * g * t^2 where “d” is the distance a body falls freely in a gravitation field during t Seconds and “g” has an approximate value of 9.81 m/s2 Example 2 x(t) = exp (-alpha * t ) * cos ( omega * t )
11
Example I Using MATLAB we want to create a table of values of time and distance for time increments between 0 and 10 seconds.
12
Example II Using MATLAB we’ll do an analysis of a suspension system and plot position versus time as the system responds to an initial displacement.
13
Continuing with today’s Discussion MATLAB Help and Demos Introduce various MATLAB windows Use the Command Window Use the Edit Window View results in the Command Window and the Graphics Window
14
Discussion Next Class- MATLAB Environment MATLAB variables Working with Matrices Scalar Operations Precedence of Arithmetic Operators Array Operations Saving your Work –Saving Variables –M-files (Writing and saving programs)
15
And now... OFF TO MATLAB… Learn by doing...
16
Referances www.engr.uaa.alaska.edu/soe/courses /engr161/www.engr.uaa.alaska.edu/soe/courses /engr161/
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.