MATLAB Tutorials Session I Introduction to MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU.

Slides:



Advertisements
Similar presentations
MATLAB – A Computational Methods By Rohit Khokher Department of Computer Science, Sharda University, Greater Noida, India MATLAB – A Computational Methods.
Advertisements

Introduction to Matlab. I use Matlab for: Data analysis Data plotting Image Analysis Also – Simulations (solving odes/pdes/finite element methods) – Minimisations,
Lecture 6 MATLAB functions Basics of Built-in Functions, Help Feature, Elementary Functions (e.g., Polynomials, Trigonometric Functions), Data Analysis,
Introduction to MATLAB
Matlab Matlab is a powerful mathematical tool and this tutorial is intended to be an introduction to some of the functions that you might find useful.
Introduction to MATLAB 7 for Engineers
Introduction to MATLAB Northeastern University: College of Computer and Information Science Co-op Preparation University (CPU) 10/22/2003.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers William J. Palm.
Matrix Mathematics in MATLAB and Excel
Introduction to Array The fundamental unit of data in any MATLAB program is the array. 1. An array is a collection of data values organized into rows and.
Arithmetic Operations on Matrices. 1. Definition of Matrix 2. Column, Row and Square Matrix 3. Addition and Subtraction of Matrices 4. Multiplying Row.
Matlab intro The Environment
Introduction to MATLAB ENGR 1187 MATLAB 1. Programming In The Real World Programming is a powerful tool for solving problems in every day industry settings.
1 MATLAB 基礎. 2 MATLAB  Workspace: environment (address space) where all variables reside  After carrying out a calculation, MATLAB assigns the result.
Builtin and user defined functions
MATLAB and SimulinkLecture 11 To days Outline  Introduction  MATLAB Desktop  Basic Features  Branching Statements  Loops  Script file / Commando.
MATLAB Basics With a brief review of linear algebra by Lanyi Xu modified by D.G.E. Robertson.
MATLAB INTRO CONTROL LAB1  The Environment  The command prompt Getting Help : e.g help sin, lookfor cos Variables Vectors, Matrices, and Linear Algebra.
Martin Ellison University of Warwick and CEPR Bank of England, December 2005 Introduction to MATLAB.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
Introduction to MATLAB Session 1 Prepared By: Dina El Kholy Ahmed Dalal Statistics Course – Biomedical Department -year 3.
Introduction to MATLAB January 18, 2008 Steve Gu Reference: Eta Kappa Nu, UCLA Iota Gamma Chapter, Introduction to MATLAB,
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
CSE123 Lecture 5 Arrays and Array Operations. Definitions Scalars: Variables that represent single numbers. Note that complex numbers are also scalars,
1 Lab of COMP 406 Teaching Assistant: Pei-Yuan Zhou Contact: Lab 1: 12 Sep., 2014 Introduction of Matlab (I)
MEGN 536 – Computational Biomechanics MATLAB: Getting Started Prof. Anthony J. Petrella Computational Biomechanics Group.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
Chapter 2 Numeric, Cell, and Structure Arrays. Physics Connection - Specification of a position vector using Cartesian coordinates. Figure 2.1–1 2-2 The.
ENG 1181 College of Engineering Engineering Education Innovation Center MATLAB is a powerful program for numerical computations, plotting and programming.
Introduction to MATLAB ENGR 1181 MATLAB 1. Programming In The Real World Programming is a powerful tool for solving problems in every day industry settings.
A Brief Introduction to Matlab Laila Guessous Dept. of Mechanical Engineering Oakland University.
Introduction to Engineering MATLAB – 1 Introduction to MATLAB Agenda Introduction Arithmetic Operations MATLAB Windows Command Window Defining Variables.
EECE 360/460 Matlab Tutorial Jan Outline What is Matlab? What is Matlab? Matlab Interface Matlab Interface Basic Syntax Basic Syntax Plotting Graphs.
Matlab Basics Tutorial. Vectors Let's start off by creating something simple, like a vector. Enter each element of the vector (separated by a space) between.
MATLAB Basics. The following screen will appear when you start up Matlab. All of the commands that will be discussed should be typed at the >> prompt.
Arrays 1 Multiple values per variable. Why arrays? Can you collect one value from the user? How about two? Twenty? Two hundred? How about… I need to collect.
Matlab Programming for Engineers Dr. Bashir NOURI Introduction to Matlab Matlab Basics Branching Statements Loops User Defined Functions Additional Data.
Introduction to Matlab Module #2 Page 1 Introduction to Matlab Module #2 – Arrays Topics 1.Numeric arrays (creation, addressing, sizes) 2.Element-by-Element.
Scientific Computing Introduction to Matlab Programming.
ME6104: CAD. Module 4. ME6104: CAD. Module 4. Systems Realization Laboratory Module 4 Matlab ME 6104 – Fundamentals of Computer-Aided Design.
ENG College of Engineering Engineering Education Innovation Center 1 Array Accessing and Strings in MATLAB Topics Covered: 1.Array addressing. 2.
Working with Arrays in MATLAB
INTRODUCTION TO MATLAB MATLAB is a software package for computation in engineering, science, and applied mathemat-ics. It offers a powerful programming.
A string is an array of characters Strings have many uses in MATLAB Display text output Specify formatting for plots Input arguments for some functions.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers William J. Palm.
Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz SUNY-New Paltz “Lecture 2”
Today we will learn MATLAB Click Start  All programm  Class Software  Matlab This command window will be seen with a prompt sign >> Any command can.
Introduction to Engineering MATLAB – 4 Arrays Agenda Creating arrays of numbers  Vectors: 1-D Arrays  Arrays: 2-D Arrays Array Addressing Strings & String.
Introduction to MATLAB 1.Basic functions 2.Vectors, matrices, and arithmetic 3.Flow Constructs (Loops, If, etc) 4.Create M-files 5.Plotting.
1 Lecture 3 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
CMPS 1371 Introduction to Computing for Engineers VECTORS.
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 2 : Matlab - Getting Started.
1 Faculty Name Prof. A. A. Saati. 2 MATLAB Fundamentals 3 1.Reading home works ( Applied Numerical Methods )  CHAPTER 2: MATLAB Fundamentals (p.24)
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
“Moh’d Sami” AshhabSummer 2008University of Jordan MATLAB By (Mohammed Sami) Ashhab University of Jordan Summer 2008.
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
ENG College of Engineering Engineering Education Innovation Center 1 Arrays in MATLAB Topics Covered: 1.Creating arrays of numbers vectors matrices.
ECE 1304 Introduction to Electrical and Computer Engineering
Introduction to MATLAB for Engineers, Third Edition
Numeric, Cell and Structural Arrays One of the strenghts of MATLAB is the capabilty to handle collection of numbers called ARRAYS. MATLAB refers to scalars,
ECE 1304 Introduction to Electrical and Computer Engineering
INTRODUCTION TO BASIC MATLAB
MATLAB DENC 2533 ECADD LAB 9.
MATH 493 Introduction to MATLAB
Use of Mathematics using Technology (Maltlab)
Communication and Coding Theory Lab(CS491)
Introduction to MATLAB
Simulation And Modelling
Matlab Basics Tutorial
Working with Arrays in MATLAB
Presentation transcript:

MATLAB Tutorials Session I Introduction to MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU

Tutorial Outline Session 1: Introduction to MATLAB Session 2: Programming in MATLAB Session 3: Plotting in MATLAB Session 4: Mathematical Applications using MATLAB Session 5: Mathematical Applications using MATLAB (cont.) Session 6: Engineering Applications using MATLAB Session 7: Open for specific problems Department of Mechanical Engineering, LSU

Session Outline  Overview of MATLAB  Using the built-in functions  Constants and Variables  Basic Arithmetic Operations  Matrices and Computation  Solving simple equations Department of Mechanical Engineering, LSU

What is MATLAB? MATLAB is basically a computing tool for engineers and mathematicians. Features include:  Interactive programming environment  Graphing facilities  Built-in functions  Toolboxes designed for specialized field of applications Department of Mechanical Engineering, LSU

Background info about MATLAB  MATLAB is an acronym for Matrix Laboratory  Cleve Moler was the original creator of MATLAB  MATLAB is now a product of Math Works Inc. co- founded by Cleve Moler and Jack Little.  First version of it appeared as early as 1981  Initially written for matrix computations, it contained only 3000 lines of source code written in FORTRAN Department of Mechanical Engineering, LSU

What can MATLAB do for you?  Produce effective solutions  Compact the time invested in analysis and development  Reduce project costs  Quickly test and compare multiple alternatives  Modeling and simulation  ……………………………………………….ad infinitum Department of Mechanical Engineering, LSU

Getting Started……. Prerequisites:  Basic knowledge of linear algebra  Some computer experience (helpful but not necessary)  Curiosity!!!!! Department of Mechanical Engineering, LSU

Basic Arithmetic Operations Addition:a+b Subtraction:a- b Multiplication:a*b Division:a/b Power:a^b Note the symbols being used for the operators. Department of Mechanical Engineering, LSU

In MATLAB…. Department of Mechanical Engineering, LSU

Naming Constants and Variables  The value of  is stored in MATLAB as pi  The contents of the variable ans change with every answer  Variable names can contain upto 31 characters  Every variable must start off with a letter  When you write the semicolon ‘;’ at the end of the statement the computer will not display the result after you press the return key.  MATLAB is case sensitive. A & a are identified different Department of Mechanical Engineering, LSU

In MATLAB…. Department of Mechanical Engineering, LSU

Built-in math functions abs(x) absolute value of x Sin(x) sine of x (where x is in radians) asin(x) arcsine of x exp(x) exponential of x log(x) natural logarithm of x log10(x) base 10 logarithm of x sqrt(x) square root of x imag(x) imaginary part of complex number x real(x) real part of the complex number x Department of Mechanical Engineering, LSU

In MATLAB….. To get more information about other functions type at command prompt: >>help elfun Department of Mechanical Engineering, LSU

Vectors and matrices  An ordered collection of numbers separated by commas or spaces can be defined in MATLAB as an array or vector  Example: A=[ ] is an array of 1 row and 5 columns  A matrix is defined as an array of n  n elements  The elements of an array are identified by their index  The number of elements of an array can be retrieved using the length function  The addition and subtraction are defined only for arrays of the same length Department of Mechanical Engineering, LSU

In MATLAB…. Department of Mechanical Engineering, LSU

Vectors and matrices (cont..)  Array of equally spaced elements can be entered by stating the first element, the increment and the last element  When the increment is 1 it can be omitted Department of Mechanical Engineering, LSU

Vectors and matrices (cont..)  Array multiplication in MATLAB is indicated by “.*”  For example : A.*B is the product of two arrays  Array division in MATLAB is indicated by “./”  For example : A./B is the quotient of two arrays  We can also raise the elements of the array to the same power by using the operator “.^”  Many built-in functions can be applied to the array by simply using the array name as the argument Department of Mechanical Engineering, LSU

In MATLAB…. Department of Mechanical Engineering, LSU

Simple plots using arrays Department of Mechanical Engineering, LSU

Plot result….. Department of Mechanical Engineering, LSU

Row Vectors and Column Vectors  One dimensional arrays can be considered as row vectors  Column vectors are generated by entering an array of numbers separated by semicolons “;”  Row vectors and column vectors can be converted into each other by transposition operation “ ‘ “

Department of Mechanical Engineering, LSU In MATLAB….

Department of Mechanical Engineering, LSU Defining a matrix  Matrices are defined as two dimensional arrays  Different rows are separated by semi colons or type each row separately and press enter  Any element of a matrix is identified by two indices: the first indicates the row and the second indicates the column

Department of Mechanical Engineering, LSU In MATLAB….

Department of Mechanical Engineering, LSU Cont…  The number of rows and columns in a matrix is retrieved by size function  We can create a new matrix by putting two matrices besides each other

Department of Mechanical Engineering, LSU Cont…  We can also extract a sub matrix out of a matrix

Cont… Department of Mechanical Engineering, LSU  We can generate a matrix with the same number of rows and columns as A, with all the elements equal to one, using the command ones  Similarly using the command zeroes we can get all the elements of the matrix as zeroes

Department of Mechanical Engineering, LSU Polynomials….  Polynomial is expressed in MATLAB as an array of coefficients, A=[1 2 -4]  The equation is solved by using the function roots(A)  The coefficients of the polynomial can be retrieved from its roots through the function poly()  The value of a polynomial at point x is obtained by function polyval(A,x) where A is the array, the coefficients of the polynomial are stored

Department of Mechanical Engineering, LSU In MATLAB….

Department of Mechanical Engineering, LSU Complex Numbers

Department of Mechanical Engineering, LSU Solving systems of Equations… x 1 + 2x 2 + x 3 = 4 2x 1 + 3x 2 - x 3 = 9 4x 1 - x 2 +2x 3 = 0

Department of Mechanical Engineering, LSU In MATLAB….

Department of Mechanical Engineering, LSU Looking ahead…. There are several books written on MATLAB where a good Description about the functions is given.  Introduction to MATLAB for Engineers and Scientists Delores M. Etter & David C. Kentucky  A guide to MATLAB: for Beginners and experienced users Brian R. Hunt, Ronald L. Lipsman & JM Rosenberg

Department of Mechanical Engineering, LSU Next Session…. Programming in MATLAB :  How to use M Files  Programming functions  Control Structures  Displaying output in different formats

Thank You Department of Mechanical Engineering, LSU