What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad.

Slides:



Advertisements
Similar presentations
Introduction to Matlab
Advertisements

MATLAB – A Computational Methods By Rohit Khokher Department of Computer Science, Sharda University, Greater Noida, India MATLAB – A Computational Methods.
StatLab Workshop Yale University Maximiliano Appendino, Economics October 18 th, 2013.
Introduction to MATLAB The language of Technical Computing.
Introduction to Matlab
Introduction to Matlab Workshop Matthew Johnson, Economics October 17, /13/20151.
Engineering Computation using MATLAB
EGR 106 – Week 2 – Arrays & Scripts Brief review of last week Arrays: – Concept – Construction – Addressing Scripts and the editor Audio arrays Textbook.
Lecture 2 MATLAB fundamentals Variables, Naming Rules, Arrays (numbers, scalars, vectors, matrices), Arithmetical Operations, Defining and manipulating.
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.
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.
Introduction to programming in MATLAB MATLAB can be thought of as an super-powerful graphing calculator Remember the TI-83 from calculus? With many more.
1 MATLAB 基礎. 2 MATLAB  Workspace: environment (address space) where all variables reside  After carrying out a calculation, MATLAB assigns the result.
Lecture 13: M/O/F/ for Engineering Applications - Part 1 BJ Furman 26NOV2012.
Martin Ellison University of Warwick and CEPR Bank of England, December 2005 Introduction to MATLAB.
Objectives Understand what MATLAB is and why it is widely used in engineering and science Start the MATLAB program and solve simple problems in the command.
ELG 3120 Signal and System Analysis 1 Introduction to MATLAB TAs Wei Zhang Ozgur Ekici (Section A)(Section B) ELG 3120 Lab Tutorial 1.
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.
MATLAB An Introduction to MATLAB (Matrix Laboratory) 1.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
Introduction to Engineering MATLAB – 6 Script Files - 1 Agenda Script files.
Matlab Workshop 1/10/07 Lesson 1: Matlab as a graphing calculator.
INTRODUCTION TO MATLAB LAB# 01
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.
Introduction to Matlab Module #2 Page 1 Introduction to Matlab Module #2 – Arrays Topics 1.Numeric arrays (creation, addressing, sizes) 2.Element-by-Element.
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
CMPS 1371 Introduction to Computing for Engineers MatLab.
10/24/20151 Chapter 2 Review: MATLAB Environment Introduction to MATLAB 7 Engineering 161.
Basics of MATLAB By DR. Wafaa Shabana
MATLAB Environment ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne.
Matlab 14.html Cost: $100 Available in labs on Windows and Unix machines.
Introduction to MATLAB ENGR 1181 MATLAB 1. Opening MATLAB  Students, please open MATLAB now.  CLICK on the shortcut icon → Alternatively, select… start/All.
Chapter 3 MATLAB Fundamentals Introduction to MATLAB Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 1 – Matlab Overview EGR1302. Desktop Command window Current Directory window Command History window Tabs to toggle between Current Directory &
INTRODUCTION TO MATLAB MATLAB is a software package for computation in engineering, science, and applied mathemat-ics. It offers a powerful programming.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers William J. Palm.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
INTRODUCTION TO MATLAB DAVID COOPER SUMMER Course Layout SundayMondayTuesdayWednesdayThursdayFridaySaturday 67 Intro 89 Scripts 1011 Work
The Hong Kong Polytechnic University Industrial Centre MatLAB Lesson 1 : Overview & Environment Edward Cheung Room W311g.
INTRODUCTION TO MATLAB Dr. Hugh Blanton ENTC 4347.
Digital Image Processing Introduction to MATLAB. Background on MATLAB (Definition) MATLAB is a high-performance language for technical computing. The.
Introduction to Engineering MATLAB – 4 Arrays Agenda Creating arrays of numbers  Vectors: 1-D Arrays  Arrays: 2-D Arrays Array Addressing Strings & String.
BRIAN D. HAHN AND DANIEL T. VALENTINE THIRD EDITION Essential MATLAB® for Engineers and Scientists.
Recap Functions with No input OR No output Determining The Number of Input and Output Arguments Local Variables Global Variables Creating ToolBox of Functions.
Matlab for Engineers Matlab Environment Chapter 2.
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.
Introduction to Programming on MATLAB Ecological Modeling Course Sep 11th, 2006.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 2.1 MATLAB ® opening window.
Lecture 12: M/O/F/ for Engineering Applications B Burlingame 27 April 2016.
An Introduction to Programming in Matlab Emily Blumenthal
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
ECE 1304 Introduction to Electrical and Computer Engineering
Release Numbers MATLAB is updated regularly
MATLAB DENC 2533 ECADD LAB 9.
Matlab Workshop 9/22/2018.
EEE 244 Numerical Methods In Electrical Engineering
Use of Mathematics using Technology (Maltlab)
MATLAB – What Is It ? Name is from matrix laboratory Powerful tool for
StatLab Workshop: Intro to Matlab for Data Analysis and Statistical Modeling 11/29/2018.
MATLAB – What Is It ? Name is from matrix laboratory Powerful tool for
Communication and Coding Theory Lab(CS491)
CSCI N317 Computation for Scientific Applications Unit 1 – 1 MATLAB
Chapter 2 MATLAB Environment
Presentation transcript:

What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad

MATLAB Excels at Numerical calculations Especially involving matrices Graphics MATLAB stands for Matrix Laboratory

Why MATLAB Easy to use Versatile Built in programming language Not a general purpose language like C/C++ or Java MATLAB was written in C Medical imaging Fluid Dynamics

Getting Started Type in matlab at the shell prompt in your terminal. MATLAB opens to a default window configuration

MATLAB uses a standard windows menu bar To exit MATLAB use the close icon or from the menu: File->Exit MATLAB

Command Window Enter commands at the prompt Current Directory MATLAB Windows Command History Workspace Window

You can use the command window much like you’d use a calculator The standard order of operation rules apply Command Window

Workspace Window

Scalar Vector 2-D Matrix

Document Window If you double click on any variable in the workspace window MATLAB launches a document window containing the array editor You can edit variables in the array editor

Document Window

Figure Window When Figures are created a new window opens It’s extremely easy to create graphs in MATLAB Try plotting The semicolon suppresses the output from each command

Editing Window This window allows you to type and save a series of commands without executing them There are several ways to open an editing window –From the file menu –With the new file icon

Open an editing window from the file menu or with the new file icon

Save and Run Write your code in the editing window, then run it using the Save and Run icon

Solving Problems with MATLAB

Naming Variables All names must start with a letter They may contain letters, numbers and the underscore ( _ ) Names are case sensitive There are certain keywords you can’t use (iskeyword)

The Basic Data Type in MATLAB: Matrices Group of numbers arranged into rows and columns Single Value (Scalar) Matrix with one row and one column Vector (One dimensional matrix) One row or one column Matrix (Two dimensional)

Array Operations Using MATLAB as a glorified calculator is OK, but its real strength is in matrix manipulations

To create a row vector, enclose a list of values in brackets

You may use either a space or a comma as a “delimiter” in a row vector

Use a semicolon as a delimiter to create a new row

Shortcuts While a complicated matrix might have to be entered by hand, evenly spaced matrices can be entered much more readily. The command b= 1:5 or the command b = [1:5] both return a row matrix

The default increment is 1, but if you want to use a different increment put it between the first and final values

To calculate spacing between elements use linspace initial value in the array final value in the array number of elements in the array

Calculations between scalars and arrays

Calculations between arrays: addition and subtraction Addition between arrays is performed on corresponding elements Subtraction between arrays is performed on corresponding elements

MATLAB interprets * to mean matrix multiplication. The arrays a and b are not the correct size for matrix multiplication in this example Multiplication between arrays is performed on corresponding elements if the.* operator is used

Array Operations Array multiplication.* Array division./ Array exponentiation.^ In each case the size of the arrays must match

Transpose The transpose operator changes rows to columns or vice versa.

The transpose operator makes it easy to create tables

table =[degrees;radians]’ would have given the same result

The transpose operator works on both one dimensional and two dimensional arrays

Saving Your Work If you save a MATLAB session, all that is saved are the values of the variables you have named

Save either by using the file menu or... Save with a command in the command window MATLAB automatically saves to a.mat file

Script M-files If you want to save your work, you need to create an M-file File->New->M-file Type your commands in the edit window that opens The file is saved into the current directory It runs in the command window

Comments The % sign identifies comments You need one on each line

Create a.m file that tabulates and plots the aerodynamic drag on a sphere of radius (r) of 5m as a function of velocity(V) (with V going from 0 to 100m/s). Assume the drag coeficient is 1. The drag on a sphere is given by: Drag = Cd*0.5*air_density*V 2 *πr 2 Cd - drag coeficient Air_density = 1x10^-6 Problem we can do together:

Drag problem continued: Cd = 1; V = [0:1:100]; r=5; air_density=1e-6; drag = Cd*air_density*(V.^2)*pi*r^2; table = [V',drag'] plot (V,drag) Do the results make sense?