Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.

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.
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 programming in MATLAB MATLAB can be thought of as an super-powerful graphing calculator Remember the TI-83 from calculus? With many more.
Programming For Nuclear Engineers Lecture 12 MATLAB (3) 1.
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.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
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.
Recap Graphic Window Edit Window Start Button Matrices in MATLAB Scalar Operations Order of Operations Array Operations Matrix Addition Matrix Multiplication.
1 Lab of COMP 406 Teaching Assistant: Pei-Yuan Zhou Contact: Lab 1: 12 Sep., 2014 Introduction of Matlab (I)
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.
INTRODUCTION TO MATLAB LAB# 01
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (1): Introduction.
What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad.
Introduction to Matlab Module #2 Page 1 Introduction to Matlab Module #2 – Arrays Topics 1.Numeric arrays (creation, addressing, sizes) 2.Element-by-Element.
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.
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.
1 Lecture 1 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
EGR 115 Introduction to Computing for Engineers Introduction to MATLAB Friday 29 August 2014 EGR 115 Introduction to Computing for Engineers.
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
MATLAB for Engineers, by Holly Moore. ISBN © 2007 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is.
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.
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.
1 EPIB 698C Lecture 1 Instructor: Raul Cruz-Cano
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.
1-2 What is the Matlab environment? How can you create vectors ? What does the colon : operator do? How does the use of the built-in linspace function.
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
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
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
Using Script Files and Managing Data
Chapter 2 MATLAB Environment
Presentation transcript:

Lecture 20: Choosing the Right Tool for the Job

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 Electrical EngineeringBiomedical Engineering 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 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