Matlab notes Matlab is a matrix-based, high-performance language for technical computing It integrates computation, visualisation and programming usin

Similar documents
OUTLINES. Variable names in MATLAB. Matrices, Vectors and Scalar. Entering a vector Colon operator ( : ) Mathematical operations on vectors.

Matlab Introduction. Scalar Variables and Arithmetic Operators

Desktop Command window

EGR 111 Introduction to MATLAB

Introduction to Matlab

MATLAB Tutorial Matrices & Vectors MATRICES AND VECTORS

Introduction to MATLAB

Chapter 1 Introduction to MATLAB

MATLAB Project: Getting Started with MATLAB

Introduction to Engineering gii

MATLAB Basics. Configure a MATLAB Package 6/7/2017. Stanley Liang, PhD York University. Get a MATLAB Student License on Matworks

EEE161 Applied Electromagnetics Laboratory 1

Therefore, after becoming familiar with the Matrix Method, you will be able to solve a system of two linear equations in four different ways.

Grace days can not be used for this assignment

MATLAB Project: Getting Started with MATLAB

MATLAB for beginners. KiJung Yoon, 1. 1 Center for Learning and Memory, University of Texas at Austin, Austin, TX 78712, USA

CITS2401 Computer Analysis & Visualisation

ARRAY VARIABLES (ROW VECTORS)

Matlab Tutorial: Basics

Chapter 1: An Overview of MATLAB

Matlab- Command Window Operations, Scalars and Arrays

Introduction to Matlab

MATLAB COURSE FALL 2004 SESSION 1 GETTING STARTED. Christian Daude 1

Introduction to MATLAB LAB 1

Experiment 1: Introduction to MATLAB I. Introduction. 1.1 Objectives and Expectations: 1.2 What is MATLAB?

Laboratory 1 Octave Tutorial

George Mason University ECE 201: Introduction to Signal Analysis Spring 2017

ECON 502 INTRODUCTION TO MATLAB Nov 9, 2007 TA: Murat Koyuncu

EOSC 352 MATLAB Review

Mathworks (company that releases Matlab ) documentation website is:

Class #15: Experiment Introduction to Matlab

Introduction to MATLAB programming: Fundamentals

Matlab Programming MET 164 1/24

Physics 326G Winter Class 2. In this class you will learn how to define and work with arrays or vectors.

GLY Geostatistics Fall Lecture 2 Introduction to the Basics of MATLAB. Command Window & Environment

A Brief Introduction to MATLAB

MATLAB Tutorial. Digital Signal Processing. Course Details. Topics. MATLAB Environment. Introduction. Digital Signal Processing (DSP)

Lecturer: Keyvan Dehmamy

FreeMat Tutorial. 3x + 4y 2z = 5 2x 5y + z = 8 x x + 3y = -1 xx

Matlab Review. Dr. Mark Glauser, Created by: David Marr. Mechanical Engineering Syracuse University. Matlab Review p.

CSE/NEUBEH 528 Homework 0: Introduction to Matlab

Introduction to MATLAB

What is MATLAB? It is a high-level programming language. for numerical computations for symbolic computations for scientific visualizations

MATLAB TUTORIAL WORKSHEET

An Introduction to Numerical Methods

MATH (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab

Colorado State University Department of Mechanical Engineering. MECH Laboratory Exercise #1 Introduction to MATLAB

MATLAB Demo. Preliminaries and Getting Started with Matlab

1 Introduction to Matlab

Matlab Tutorial 1: Working with variables, arrays, and plotting

Stokes Modelling Workshop

Lab of COMP 406. MATLAB: Quick Start. Lab tutor : Gene Yu Zhao Mailbox: or Lab 1: 11th Sep, 2013

MATLAB Introduction to MATLAB Programming

A very brief Matlab introduction

University of Alberta

AMS 27L LAB #2 Winter 2009

LAB 2: Linear Equations and Matrix Algebra. Preliminaries

Introduction to MATLAB

An Introduction to MATLAB II

Lab 1: Getting started with R and RStudio Questions? or

MATLAB Introduction To Engineering for ECE Topics Covered: 1. Creating Script Files (.m files) 2. Using the Real Time Debugger

EGR 102 Introduction to Engineering Modeling. Lab 05A Managing Data

How to learn MATLAB? Some predefined variables

MAT 275 Laboratory 1 Introduction to MATLAB

ELEC4042 Signal Processing 2 MATLAB Review (prepared by A/Prof Ambikairajah)

Identity Matrix: >> eye(3) ans = Matrix of Ones: >> ones(2,3) ans =

Matrices. A Matrix (This one has 2 Rows and 3 Columns) To add two matrices: add the numbers in the matching positions:

Matlab Tutorial. Get familiar with MATLAB by using tutorials and demos found in MATLAB. You can click Start MATLAB Demos to start the help screen.

Unix Computer To open MATLAB on a Unix computer, click on K-Menu >> Caedm Local Apps >> MATLAB.

Appendix A. Introduction to MATLAB. A.1 What Is MATLAB?

Lab 1 Intro to MATLAB and FreeMat

Prof. Manoochehr Shirzaei. RaTlab.asu.edu

(Creating Arrays & Matrices) Applied Linear Algebra in Geoscience Using MATLAB

Engineering Innovation Center MATLAB Basics

PART 1 PROGRAMMING WITH MATHLAB

Dr Richard Greenaway

MATLAB SUMMARY FOR MATH2070/2970

Computer Project: Getting Started with MATLAB

Introduction to MATLAB

2.0 MATLAB Fundamentals

MATLAB - Lecture # 4

AMATH 352: MATLAB Tutorial written by Peter Blossey Department of Applied Mathematics University of Washington Seattle, WA

Introduction to MATLAB for Engineers, Third Edition

EE3TP4: Signals and Systems Lab 1: Introduction to Matlab Tim Davidson Ext Objective. Report. Introduction to Matlab

LAB 2 VECTORS AND MATRICES

Introduction to Matlab. By: Dr. Maher O. EL-Ghossain

Page 1 of 7 E7 Spring 2009 Midterm I SID: UNIVERSITY OF CALIFORNIA, BERKELEY Department of Civil and Environmental Engineering. Practice Midterm 01

Getting started with MATLAB

Creates a 1 X 1 matrix (scalar) with a value of 1 in the column 1, row 1 position and prints the matrix aaa in the command window.

Lecture 2 Introduction to MATLAB. Dr.Tony Cahill

Introduction to MATLAB

MATLAB Tutorial III Variables, Files, Advanced Plotting

Variable Definition and Statement Suppression You can create your own variables, and assign them values using = >> a = a = 3.

INTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX

Introduction to MATLAB

To start using Matlab, you only need be concerned with the command window for now.

Essentials for the TI-83+

UNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER

Introduction to MATLAB 7 for Engineers

Finding MATLAB on CAEDM Computers

Transcription:

Matlab notes Matlab is a matrix-based, high-performance language for technical computing It integrates computation, visualisation and programming using familiar mathematical notation The name Matlab stands for matrix laboratory.

Matrices A matrix is a rectangular array of numbers Special meaning is sometimes attached to 1x1 matrices, which are scalars, and to matrices with only one row or column, which are vectors The operations in Matlab are designed to be as natural as possible. Matlab allows you to work with entire matrices quickly and easily.

Matlab windows There are typically three windows: the Command Window (where the main typing can be done) an editor (where you can type programs) figures (where the figures can be displayed and edited).

Matlab help At any time, you can type "help topic'' in the command window to find help on a particular topic You can also press the help button for a comprehensive overview.

Variables Variable names consist of a letter, followed by any number of letters, digits, or underscores Matlab is case sensitive: A and a are not the same variable To view the matrix assigned to any variable, simply enter the variable name.

Entering matrices If you type a=[1 2; 3 4] the output will be a 2x2 matrix To stop the output showing, end with a semicolon; Thus, if you type b=[5 6 7; 8 9 10]; there's no output, but any any time you can type b to see your 2x3 matrix.

Vectors You can also generate a vector (which, remember, is a matrix with only one row or column) by using a colon: x=0:10; generates the vector [1 2 3 4 5 6 7 8 9 10] The default gap between numbers is 1, but you can make it finer by using two colons: x=0:0.1:10; generates [0 0.1 0.2 0.3 0.4L 9.8 9.9 10].

Operators You can use the regular function operators (+,-,*,/,^,) But remember that Matlab is matrix-based So if A and B are matrices (or vectors) then A*B will also be a matrix.

Element by element operations What if you just want to multiply the elements of two vectors together? In this case, use a period before the operator. So [1 2 3].*[4 5 6]=[4 10 18] Forgetting the period is one of the most common mistakes.

M-files M-files are text files containing Matlab code Use the Matlab Editor to create a file containing the same statements you would type at the Matlab command line Save the file under a name that ends in.m You probably want to save all your files in the same place.

Figures The function plot is a linear 2D plot If you have vectors x and y that are the same size, then plot(x,y) plots the x vector on the horizontal (x) axis and the y vector on the vertical (y) axis.

A plotting example To plot the function y = x 2, we write x = -5:0.1:5; y = x.^2; plot(x,y) Notice the period before the power: this squares every element of the vector.

Plotting multiple graphs If we want to plot y = x 2 and z = x 3 on the same graph, we write: x=-5:0.1:5; y=x.^2; z=x.^3; plot(x,y,x,z) horizontal vertical horizontal vertical.

Getting started Start Matlab (Programs Matlab) Command window: Click "New File" This creates an M-file.

Type this in your M-file %Don't forget the period! a=[1 2 3]; b=[4 5 6]; c=a.*b

Running your programs Save your M-file in the folder you created To run, use the green button Change current Matlab directory Yes.

Output Check the command window for the output Does this seem right? Type "help file" to in the command window and see what happens.

Off you go Now you're ready to begin There's no data to load, you have to type the programs in yourself The first lab is Chapter 8 s from the textbook Good luck!