Introduction to MATLAB ENGR 1181 MATLAB 1. Opening MATLAB  Students, please open MATLAB now.  CLICK on the shortcut icon → Alternatively, select… start/All.

Slides:



Advertisements
Similar presentations
Introduction to Applications & Basic Features. What is MATLAB®? MATLAB® /Simulink® is a powerful software tool for: Performing mathematical computations.
Advertisements

1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 10.
Introduction to MATLAB for Biomedical Engineering BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Lesson 2: Element-wise vs. matrix operations.
MATLAB ME1107 Y Yan Reference: MATLAB for Engineers by Holly Moore (Pearson Prentice Hall)
Introduction to MATLAB
EGR 106 – Week 2 – Arrays & Scripts Brief review of last week Arrays: – Concept – Construction – Addressing Scripts and the editor Audio arrays Textbook.
Dr. Jie Zou PHY Welcome to PHY 3320 Computational Methods in Physics and Engineering.
Introduction to MATLAB
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.
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.
Chapter 5 Review: Plotting Introduction to MATLAB 7 Engineering 161.
MATLAB INTRO CONTROL LAB1  The Environment  The command prompt Getting Help : e.g help sin, lookfor cos Variables Vectors, Matrices, and Linear Algebra.
THE MATLAB ENVIRONMENT VARIABLES BASIC COMMANDS HELP HP 100 – MATLAB Wednesday, 8/27/2014
Introduction to MATLAB
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (2): MATLAB Environment (Chapter 1)
IC3003 B ASIC S CIENTIFIC C OMPUTING Lecture 1 Monday 08:30-11:30 U204a.
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.
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.
Introduction to Engineering MATLAB – 1 Introduction to MATLAB Agenda Introduction Arithmetic Operations MATLAB Windows Command Window Defining Variables.
Release Numbers MATLAB is updated regularly The Mathworks packages their software in groups, called releases, New releases are issued twice a year in the.
Introduction to Engineering MATLAB – 6 Script Files - 1 Agenda Script files.
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.
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.
Introduction to Engineering MATLAB – 2 Introduction to MATLAB - 2 Agenda Defining Variables MATLAB Windows.
CMPS 1371 Introduction to Computing for Engineers MatLab.
10/24/20151 Chapter 2 Review: MATLAB Environment Introduction to MATLAB 7 Engineering 161.
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 &
ENG 1181 College of Engineering Engineering Education Innovation Center MATLAB – 2D Plots 1 Go to the class drive: ---> MatLab - Graphing ---> Seed Files.
1 DKT 211 Basic Communication Engineering LAB # 1A : (Lecture 1) Introduction to Matlab  Basic Features  Scientific features  Array Operations  Script.
INTRODUCTION TO MATLAB MATLAB is a software package for computation in engineering, science, and applied mathemat-ics. It offers a powerful programming.
Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz SUNY-New Paltz “Lecture 2”
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.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
A simple classification problem Extract attributes Pattern Pattern recognition decision x C1 C2.
Array Creation ENGR 1181 MATLAB 2. Civil engineers store seismic data in arrays to analyze plate tectonics as well as fault patterns. These sets of data.
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
ENG 1181 First-Year Engineering Program College of Engineering Engineering Education Innovation Center First-Year Engineering Program MAT - Introduction.
Matlab Introduction  Getting Around Matlab  Matrix Operations  Drawing Graphs  Calculating Statistics  (How to read data)
Array Creation ENGR 1187 MATLAB 2. Today’s Topics  Arrays: What are they?  Vectors  Matrices  Creating Arrays.
Introduction to MATLAB Zongqiang Liao Research Computing Group UNC-Chapel Hill.
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 MATLAB Dr. Hugh Blanton ENTC 4347.
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.
BRIAN D. HAHN AND DANIEL T. VALENTINE THIRD EDITION Essential MATLAB® for Engineers and Scientists.
Matlab for Engineers Matlab Environment Chapter 2.
Introduction to MATLAB ENGR 1181 MATLAB 1. MATLAB Built-in Math Functions  Pre-defined in MATLAB ready for use exp(x) – exponential (e x ) log(x) – natural.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
CS100A, Fall 1998, Lecture 201 CS100A, Fall 1998 Lecture 20, Tuesday Nov 10 More Matlab Concepts: plotting (cont.) 2-D arrays Control structures: while,
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.
Introduction to MATLAB
ECE 1304 Introduction to Electrical and Computer Engineering
MATLAB DENC 2533 ECADD LAB 9.
MATH 493 Introduction to MATLAB
Array Creation ENGR 1181 MATLAB 02.
INTRODUCTION TO MATLAB
Experiment No. (1) - an introduction to MATLAB
Introduction to MATLAB
MatLab Program Used to Calculate Interactive
Chapter 2 MATLAB Environment
Presentation transcript:

Introduction to MATLAB ENGR 1181 MATLAB 1

Opening MATLAB  Students, please open MATLAB now.  CLICK on the shortcut icon → Alternatively, select… start/All programs/MATLAB  The following prompt should appear in the command window: >>

MATLAB Display  Ribbon Useful operations  Current Directory List of files  Workspace Defined variable values  Command history Displays what has been typed Command prompt Command Window

MATLAB’s Working Directory  Current working directory is where files are saved and run from  When you first start MATLAB, it is a good practice to change the working directory to your Z: drive or USB device  Browse icon available

Working with Variables  Variables defined previously can be used to do calculations  Define: a = 8; my_var = 12; >> a + my_var ans = 20 >> a*my_var^2 ans = 1152

Rules in Naming Variables  Names must begin with a letter  May contain letters, digits, and the underscore character No spaces are allowed  MATLAB is case sensitive, it distinguishes between uppercase and lowercase letters  Avoid naming variables with currently defined MATLAB functions Ex: exp, sin, cos, sqrt, length, mean, max, min etc.

MATLAB Built-in Math Functions  For trigonometric functions, x is entered in radians sin(x), cos(x), asin(x), acos(x), tan(x), cot(x)  To enter x in degrees… sind(x) where x is in degrees  Ex: To calculate sin(/2) >>sin(pi/2)  is defined as “pi” ans = 1

Saving a Script File  Script files must be saved after completion  In our class use Save As to your Z:\ or USB drive This should be the same as the working directory you specified upon starting MATLAB SAVE YOUR WORK AS YOU GO!

Saving a Script File  The name of the script file is governed by the following rules: No spaces are allowed The name cannot start with a numeric No special characters are allowed (except underscore) Allowed:Not Allowed: Prob1a.mProb 1a.m (blank space) Prob_1a.m1aProb.m (can’t start with numeric) Prob-1a.m (no special characters)

Useful Programming Commands  To clear the command window, use “clc” >> clc  To send a text message to the command window or display contents of a variable, use “disp(…)” >> disp(‘Brutus Buckeye’) NOTE: single quotes

What is a vector? A vector is an ordered list of several numbers and is a one-dimensional array  Row Vectors are horizontal: [ ]  Column Vectors are vertical: [ ]

Row Vectors vs. Column Vectors  You need to choose which type to create  This will depend on your data and the type of calculations you need to do  If you choose the 'wrong' type, you can transpose your row vector to a column vector, or a column to a row

Creating Row Vectors  A row vector is created by typing the elements inside square brackets [ ]  The elements are separated by commas OR spaces  You will likely assign your vector to a variable Remember to use valid variable names

Creating Column Vectors  A column vector is separated by typing the elements inside square brackets [ ]  The elements are separated by a semicolon OR by an 'enter'  You will likely assign your vector to a variable Remember to use valid variable names

Vector - Vector Math Summary For two vectors x and y : Addition x + yory + x Subtractionx – yory – x Multiplicationx.* yory.* x Divisionx./ yory./ x Exponentx.^ y or y.^ x You must always use the dot operator for Multiplication, Division, and Exponent

Function: plot()  Ex: >> plot(x_vec, y_vec)  Will generate a line where x_vec is the vector of x values and y_vec is the vector of corresponding y values

Plot Formatting  Title: title('Distance vs. Intensity')  Axis Labels: xlabel('Intensity, w/m^2') ylabel('Distance, m')  Legend: legend('Data Set 1', 'Data Set 2’)