MATH 493 Introduction to MATLAB

Slides:



Advertisements
Similar presentations
Lecture 5.
Advertisements

Introduction to M ATLAB Programming Ian Brooks Institute for Climate & Atmospheric Science School of Earth & Environment
Introduction to MATLAB
Introduction to Matlab Workshop Matthew Johnson, Economics October 17, /13/20151.
Introduction to MATLAB for Biomedical Engineering BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Lesson 2: Element-wise vs. matrix operations.
EGR 106 – Week 2 – Arrays Definition, size, and terminology Construction methods Addressing and sub-arrays Some useful functions for arrays Character arrays.
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.
1 MATLAB 基礎. 2 MATLAB  Workspace: environment (address space) where all variables reside  After carrying out a calculation, MATLAB assigns the result.
Introduction to MATLAB Session 1 Prepared By: Dina El Kholy Ahmed Dalal Statistics Course – Biomedical Department -year 3.
MATLAB Tutorials Session I Introduction to MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU.
Introduction to MATLAB
IC3003 B ASIC S CIENTIFIC C OMPUTING Lecture 1 Monday 08:30-11:30 U204a.
ELG 3120 Signal and System Analysis 1 Introduction to MATLAB TAs Wei Zhang Ozgur Ekici (Section A)(Section B) ELG 3120 Lab Tutorial 1.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
A Brief Introduction to Matlab Laila Guessous Dept. of Mechanical Engineering Oakland University.
MATLAB An Introduction to MATLAB (Matrix Laboratory) 1.
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.
Chapter 1: Getting Started with MATLAB MATLAB for Scientist and Engineers Using Symbolic Toolbox.
What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad.
Introduction to Engineering MATLAB – 2 Introduction to MATLAB - 2 Agenda Defining Variables MATLAB Windows.
10/24/20151 Chapter 2 Review: MATLAB Environment Introduction to MATLAB 7 Engineering 161.
Chapter 6 Review: User Defined Functions Introduction to MATLAB 7 Engineering 161.
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.
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
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.
MA/CS 375 Fall 2002 Lecture 2. Motivation for Suffering All This Math and Stuff Try the Actor demo from
Introduction to Matlab Patrice Koehl Department of Biological Sciences National University of Singapore
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.
Manipulating MATLAB Vector, Matrices 1. Variables and Arrays What are variables? You name the variables (as the programmer) and assign them numerical.
CS100A, Fall 1998, Lecture 201 CS100A, Fall 1998 Lecture 20, Tuesday Nov 10 More Matlab Concepts: plotting (cont.) 2-D arrays Control structures: while,
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
전자장 1 실험 - Matlab 사용법 - Photonic Systems Laboratory School of EE, Seoul National University Photonic Systems Lab School of EECS, S.N.U.
ECE 1304 Introduction to Electrical and Computer Engineering
Introduction to MATLAB
Signals in Matlab Matlab as a name stands for Matrix Laboratory.
Introduction to Matlab
Matlab Training Session 4: Control, Flow and Functions
EGR 115 Introduction to Computing for Engineers
Chapter 4 MATLAB Programming
Matrices and Arrays.
INTRODUCTION TO BASIC MATLAB
Seminar 1 for DCSP Using Matlab.
MATLAB DENC 2533 ECADD LAB 9.
Matlab Workshop 9/22/2018.
Introduction To MATLAB
EEE 244 Numerical Methods In Electrical Engineering
StatLab Matlab Workshop
Matlab review Matlab is a numerical analysis system
Use of Mathematics using Technology (Maltlab)
StatLab Workshop: Intro to Matlab for Data Analysis and Statistical Modeling 11/29/2018.
Matlab tutorial course
Lecture 2 Introduction to MATLAB
Vectors and Matrices I.
Introduction to MATLAB Programming
Introduction to MATLAB
INTRODUCTION TO MATLAB
Introduction to MATLAB
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
Using Script Files and Managing Data
Matlab Training Session 2: Matrix Operations and Relational Operators
-seminar 1 for digital signal processing
Matlab Basics Tutorial
EECS Introduction to Computing for the Physical Sciences
This is….
Presentation transcript:

MATH 493 Introduction to MATLAB

MATLAB MATLAB is run as an interactive program You type a command, MATLAB responds with an answer; repeat MATLAB processing is based largely on array and matrix manipulations

MATLAB Interface

Basic Usage Enter simple calculations at the command prompt Define variables at the command prompt Use cursor keys to revisit previous commands Use first letters and cursor keys for more control

Editor Use File/New/Blank M-file to create a script file store a sequence of commands for later use editor does automatic highlighting necessary for anything more than toy examples

Further Commands Standard mathematical functions are built in: cos, sin, log, log10, exp Suppress output with semi-colon User variable names should be different from built-in functions, variables File/Clear Workspace (or type ‘clear’) to clear all variables

Matrices and MATLAB (Nearly) all MATLAB variables are matrices scalars are 1x1 matrices vectors are 1xn or nx1 matrices ‘size’ function gives dimensions of a matrix

Manually Creating Matrices Use square brackets v = [1 3 10] Semi-colons separate rows v = [1; 3; 10] Sometimes easier to write using matrix transpose, ’. Compare v = [1 3 10]’

Functions for Creating Matrices 1 Colon operator 1:5 - same as [1 2 3 4 5] 1:0.1:2 - counts by 0.1 from 1 to 2 linspace linspace(10,50, 1000) - counts from 10 to 50 using 1000 points linspace(10,50) - counts from 10 to 50 using (default) 100 points. Often used for quick graphs

Functions for Creating Matrices 2 ones ones(3) - creates 3x3 matrix of ones ones(4,1) - creates 4x1 vector of ones zeros zeros(3) - creates 3x3 matrix of zeros zeros(4,5) - creates 4x5 matrix of zeros eye - (for “Identity”) eye(3) - creates 3x3 identity matrix

This is not C Many MATLAB functions can take in single arguments or matrices Using a matrix is often faster and more clear Plotting example - graph of cosine x = linspace(0, 6*pi) y = cos(x) plot(x, y)

Plot Command Requirements ‘plot’ will generate an x vs y plot when given two equal-length vectors The plot will appear in a new window There are many plotting options; some are included in the activities

Matrix Problems! Try the following plot of a quadratic x = linspace(-2, 2) y = x^2 plot(x, y) Very common problem in course! x^2 means…. x.^2 means….

Continuing Try the exercises on the sheet. Look at the output each time to make sure you understand what each command is doing!