NatSciLab - Numerical Software Introduction to MATLAB
|
|
- Molly Burke
- 5 years ago
- Views:
Transcription
1 Outline NatSciLab - Numerical Software Introduction to MATLAB Onur Oktay Jacobs University Bremen Spring 2010
2 Outline 1 MATLAB Desktop Environment 2 The Command line A quick start Indexing 3 Operators Arithmetic (Array and Matrix) Operators Logical and Relational Operators 4 MATLAB data types MATLAB Number format: Floating Point
3 Outline 1 MATLAB Desktop Environment 2 The Command line A quick start Indexing 3 Operators Arithmetic (Array and Matrix) Operators Logical and Relational Operators 4 MATLAB data types MATLAB Number format: Floating Point
4
5 Command Window is where you type the commands and view the outputs. Command History records the commands you type at the command line. - Double-click on a command to repeat it - Right-click on a command to cut/copy/delete it Workspace shows all of the variables that are currently defined in your Matlab session. - Double-click on a variable to view it in the array editor. - Right-click on a variable to rename/delete/etc. it Matlab Editor is a specialized text editor for m-files.
6 Outline 1 MATLAB Desktop Environment 2 The Command line A quick start Indexing 3 Operators Arithmetic (Array and Matrix) Operators Logical and Relational Operators 4 MATLAB data types MATLAB Number format: Floating Point
7 When you start MATLAB, you see the prompt >> This is the command line. As we go through the slides, please copy the commands after each prompt to your MATLAB command line. We start with >> diary on MATLAB just formed a diary.txt under your current directory. Everything on the command window is copied into diary.txt until you type diary off.
8 + / ˆ We can do simple arithmetic operations ( +,, *, /,ˆ) on the command line such as >> ( ˆ2 4*7 ) / 12 ans = We can also do this calculation by assigning variable names. >> x = 2+3.5ˆ2 x = >> y = 4*7 y = 28 >> z = (x-y)/12 z =
9 ; If we do not want to see the intermediate results, we can suppress the output by putting a semicolon (;) at the end of the line. For example, with the semicolons, the sequence of commands we just entered and their outputs look like >> x = 2+3.5ˆ2; >> y = 4*7 ; >> z = (x-y)/12 ; >> z >> z =
10 If we enter an expression incorrectly, MATLAB returns an error message. For example, in the following, we left out the * in 3*x. >> x = 4; >> 3x??? 3 Missing operator, comma, or semicolon. >> Another example: >> 2*(x+y??? 2*(x+y A closing right parenthesis is missing. Check for a missing ) or a missing operator. >>
11 MATLAB recognizes all variables as arrays. Numbers are 1 1 arrays. Vectors are 1 n or n 1 arrays. Matrices are m n arrays. 3D, 4D,..., n-dimensional d 1 d 2 d n arrays. >> ThreeD = rand(5,4,3); Non-numeric arrays: logical, struct, cell arrays (more is coming soon)
12 Matrices can be formed by typing in the elements one at a time. - Type the entries in brackets [ ]. - Use semicolon ; to separate the rows. >> u = [ ]; >> u = >> A = [ ; ; ; ] A =
13 Usage Regularly spaced 1 n vectors are formed by the colon operator. vector = start:increment:end % increment = 1 by default, if not provided. Usage >> u2 = 1:3:13 % same as u2 = [ ] >> v = 1: -0.2:0; % same as v = [ ] >> v = 1:5; % same as v=[ ] Regularly spaced 1 n vectors are formed also by linspace. v = linspace(a,b,n) % Generates a 1 N vector v of equally spaced points % between and including a and b >> v2 = linspace(0,1,11);
14 zeros(m,n) produces a m n matrix of 0 s. zeros(n) produces a n n square matrix of 0 s. ones(m,n) produces a m n matrix of 1 s. ones(n) produces a n n square matrix of 1 s. eye(m,n) returns a m n matrix with 1 s on the diagonal and 0 s elsewhere. eye(n) produces a n n identity matrix. diag(v,k) when v is a vector of n components, returns a (n + k ) (n + k ) square matrix, with the elements of v on the kth diagonal. k = 0 is the main diagonal, k > 0 above the main diagonal, and k < 0 below the main diagonal. diag(a,k) for matrix A, returns a column vector v formed from the elements of the kth diagonal of A. >> m=4; n=7; >> D=diag(v2) >> v3=diag(d) >> ones(m,n) >> eye(m,n)
15 Indexing >> u(2) returns the 2nd entry of the vector u >> u(2,2) gives an error message >> A(1,3) returns the 1st row 3rd column entry of the matrix A. >> A(1,:) returns the 1st row of A >> A(:,2) returns the 2nd column of A >> A(:,[1 3]) returns the submatrix formed by the 1st and 3rd columns. >> A( [1 3 4], 2:5 ) forms the submatrix of A with the entries >> a = A(:); stacks up the columns of the matrix A
16 Indexing If u is a vector of length n, and M is a matrix with integer entries between 1 n, then u(m(1, 1)) u(m(1, 2))... u(m(1, n)) u(m(2, 1)) u(m(2, 2))... u(m(2, n)) u(m) = u(m(m, 1)) u(m(m, 2))... u(m(m, n)) >> u=1:3:13; w = u([1 3 4]) % vector with entries u(1),u(3),u(4) >> ind = [2 2; 4 1; 5 3]; u(ind) ans =
17 Linear Indexing Elements of a matrix can be called with a single index A(k). If A is m n, then A(k) = A(i,j) where k = (j 1) m + i A(k) = a(k), where a = A(:) 1 m + 1 2m (n 1)m m + 2 2m (n 1)m m + 3 2m (n 1)m m 2m 3m... nm
18 find find locates all nonzero elements of a numerical array or logical expression, and returns their linear indices. >> B = 1-2*rand(3,4); indb = find(b) >> C = magic(4); C C = >> indc = find(c>12) % indices k for which C(k)> 12 indc = We can do the same task by logical indexing (next slide)
19 Logical indexing Matlab provides you with all elements of a matrix that meet a specified condition. >> v = [ ] ; >> indv-log = (v > 2) % forms a logical variable indv-log = % 0 = false, 1 = true >>v(indv-log) ans = >> indv = find(v > 2) ans = >>v(indv) ans = indv gives indices k for which v(k) > 2 indv-log(k)=1 if v(k) meets the condition, 0 otherwise. Note: v(indv) and v(indv-log) are the same.
20 Logical indexing Example: Find all entries of A2 that are < and set them to 0. >> A2 = [0.3, 4, 7; 2, 1e-5, 5; 3e-6, 4.2 4e-9] ; >> inda2-log = (A2 < 0.001) inda2-log = >> A2(indA2-log) = 0 A2 = We can do the same quickly in 1-line as below: >> A2(A2< 0.001) = 0; >> A2(find(A2< 0.001)) = 0;
21 Outline 1 MATLAB Desktop Environment 2 The Command line A quick start Indexing 3 Operators Arithmetic (Array and Matrix) Operators Logical and Relational Operators 4 MATLAB data types MATLAB Number format: Floating Point
22 Array/Matrix operations Operation Description + Addition Subtraction. Entrywise multiplication./ Entrywise division Matrix multiplication / Matrix right division \ Matrix left division. Entrywise power Matrix Power. Transpose Complex conjugate transpose To make an operation array smart, put a dot before it. Note: Operations, which are the same for matrices & arrays, do not need a dot (+ )
23 Array/Matrix operations >> m=5; n=7; r=4; b=5; >> A = (rand(m,n)>0.5); % m n matrix >> B = [ones(m-2,3), eye(m-2,n-3); zeros(2,3), ones(2,n-3)]; >> C = randi(n,r); % n r matrix >> AplusB = A+B; AminusB = A-B; % must have size(a) = size(b) >> AC = A C; % must have size(a,2) = size(c,1) >> A B % error message follows >> AtimeB = A. B; AoverB = A./B; % must have size(a) = size(b) >> A. C % error message follows >> ba = b A; bplusa = b+a; % mult./add b to every element of A >> S = diag(1:m) + diag(ones(m-1,1),1); % m m square matrix >> S2 = Sˆ2; % same as S S >> S3 = S.ˆ2; % same as S. S
24 Matrix division and inversion Left matrix division mldivide: A is m n, B is m r. X = A\B is the least squares solution to the matrix equation A X = B. Right matrix division mrdivide: A is n m, B is r m. X = A/B is the least squares solution to the matrix equation X A = B. inv(s) calculates the inverse of a square matrix S. Note: A/B = ( B \A ) If A is a nonsingular square matrix, then X=A\B is equal to inv(a) B.
25 Matrix division and inversion >> A = [1 0 0; 0 1 0; 1 1 1]; >> b = [ 1; 0; -1]; >> x = A\b x = >> x = inv(a)*b >> A = [1 1; 1 3; 0 1]; >> b = [1; 0; 0]; x = A\b; >> lserror = A x - b >> b = [5; 11; 3]; x = A\b; >> lserror = A x - b
26 Logical and relational operators Operator Description < Less than <= Less than or equal to > Greater than >= Greater than or equal to == Equal to = Not equal to & Logical AND Logical OR Logical NOT
27 Relational operators < <= > >= == = - Always work with numerical arrays, - Always operate entrywise. - Output is always of the type logical. >> A = [5 4 1; 9 0 5; ]; >> B = [8 7 1; 9 2 5; ]; >> A == B ans = >> q = (A< 5) q =
28 Logical operators & Always operate entrywise. For each entry, both nonzero one of them nonzero both zero A & B A B A N/A 1 0 >> A = [1, 0, 0, 1, 0, 1, 4, 5, -2]; >> B = [1, 1, 0, 0, 1, 1, 6, 0, 9.253]; >> AandB = A&B AandB = >> AorB = A B AorB = >> Anegation = A Anegation =
29 Logical operators Other functions that return logical values - isempty(var): 1 if var=[], 0 else - isequal(a,b): 1 if the numer. arrays A and B are equal, 0 else. - isreal(var): 1 if var is real, 0 else - isinf(var): 1 if var=inf, 0 else - isinf(var): 1 if var=inf, 0 else See also isnumeric, islogical, ischar, iscell, isstruct, isfloat, isinteger, isa. >> help isa
30 Outline 1 MATLAB Desktop Environment 2 The Command line A quick start Indexing 3 Operators Arithmetic (Array and Matrix) Operators Logical and Relational Operators 4 MATLAB data types MATLAB Number format: Floating Point
31 MATLAB classes (data types) Class Name double, single int8, uint8, int16, uint16, int32, uint32, int64, uint64 char logical function-handle struct cell Intended Use Default numeric type. Range = e-308 to e+308 Integers. Signed/unsigned. 8,16,32,64 bits. Characters and Strings Boolean type. Can have 2 values: true or false. Pointer to a function. Structures. Fields store arrays of varying classes and sizes. Cell Arrays. Cells store arrays of varying classes and sizes.
32 MATLAB Number format MATLAB does numerical calculations in double precision, which is 15 digits. Normally only 5 digits are displayed. If we want to see all 15 digits, >> format long >> z = 26/3 z = To return to the short format, >> format short
33 MATLAB Number format A real number x can be viewed as x = s m 10 r where 0 m< 1 and s= ±. In the double-precision format all numbers are stored in 64-bit words. A 64-bit word is a sequence (b 1 b 2... b 64 ) of 0 s and 1 s. The first bit b 1 gives the sign s (0 = +, 1 = ), The next 11 bits encode the exponent r between = 1023 and 2 10 = 1024 so that r = b 2 + b b b b The remaining 52 bits are used to describe the fraction or mantissa m so that m = b 13 + b b b
34 MATLAB Number format Consequently, there are finitely many machine numbers. There are little gaps between any two neighboring machine numbers. The bigger the numbers become in absolute value, the larger become the gaps. realmax is the biggest positive number in MATLAB, realmin is the smallest positive number in MATLAB, eps is the distance from 1 to the next larger double precision number, that is eps= 2 52 x>realmax x = Inf x<-realmax x = Inf indeterminate foms such as 0/0 or Inf/Inf are assigned to NaN
35 All for today >> diary off
MAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB
MAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB In this laboratory session we will learn how to 1. Create matrices and vectors. 2. Manipulate matrices and create matrices of special types
More informationIntroduction to Matlab
Introduction to Matlab By:Mohammad Sadeghi *Dr. Sajid Gul Khawaja Slides has been used partially to prepare this presentation Outline: What is Matlab? Matlab Screen Basic functions Variables, matrix, indexing
More informationMAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB
MAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB MATLAB is a computer software commonly used in both education and industry to solve a wide range of problems. This Laboratory provides a brief
More informationIntroduction to MATLAB
58:110 Computer-Aided Engineering Spring 2005 Introduction to MATLAB Department of Mechanical and industrial engineering January 2005 Topics Introduction Running MATLAB and MATLAB Environment Getting help
More informationIntroduction to MATLAB for Engineers, Third Edition
PowerPoint to accompany Introduction to MATLAB for Engineers, Third Edition William J. Palm III Chapter 2 Numeric, Cell, and Structure Arrays Copyright 2010. The McGraw-Hill Companies, Inc. This work is
More informationDigital Image Analysis and Processing CPE
Digital Image Analysis and Processing CPE 0907544 Matlab Tutorial Dr. Iyad Jafar Outline Matlab Environment Matlab as Calculator Common Mathematical Functions Defining Vectors and Arrays Addressing Vectors
More informationTUTORIAL 1 Introduction to Matrix Calculation using MATLAB TUTORIAL 1 INTRODUCTION TO MATRIX CALCULATION USING MATLAB
INTRODUCTION TO MATRIX CALCULATION USING MATLAB Learning objectives Getting started with MATLAB and it s user interface Learn some of MATLAB s commands and syntaxes Get a simple introduction to use of
More informationComputational Mathematics
Computational Mathematics Hilary Term Lecture 1: Programming Andrew Thompson Outline for Today: Schedule this term Review Introduction to programming Examples Arrays: the foundation of MATLAB Basics MATLAB
More informationMATLAB Tutorial. Mohammad Motamed 1. August 28, generates a 3 3 matrix.
MATLAB Tutorial 1 1 Department of Mathematics and Statistics, The University of New Mexico, Albuquerque, NM 87131 August 28, 2016 Contents: 1. Scalars, Vectors, Matrices... 1 2. Built-in variables, functions,
More informationLecture 2: Variables, Vectors and Matrices in MATLAB
Lecture 2: Variables, Vectors and Matrices in MATLAB Dr. Mohammed Hawa Electrical Engineering Department University of Jordan EE201: Computer Applications. See Textbook Chapter 1 and Chapter 2. Variables
More informationIntroduction to MATLAB
to MATLAB Spring 2019 to MATLAB Spring 2019 1 / 39 The Basics What is MATLAB? MATLAB Short for Matrix Laboratory matrix data structures are at the heart of programming in MATLAB We will consider arrays
More informationIntroduction to MATLAB 7 for Engineers
PowerPoint to accompany Introduction to MATLAB 7 for Engineers William J. Palm III Chapter 2 Numeric, Cell, and Structure Arrays Copyright 2005. The McGraw-Hill Companies, Inc. Permission required for
More informationIntroduction to Matlab. Summer School CEA-EDF-INRIA 2011 of Numerical Analysis
Introduction to Matlab 1 Outline What is Matlab? Matlab desktop & interface Scalar variables Vectors and matrices Exercise 1 Booleans Control structures File organization User defined functions Exercise
More information1 Overview of the standard Matlab syntax
1 Overview of the standard Matlab syntax Matlab is based on computations with matrices. All variables are matrices. Matrices are indexed from 1 (and NOT from 0 as in C!). Avoid using variable names i and
More informationConstraint-based Metabolic Reconstructions & Analysis H. Scott Hinton. Matlab Tutorial. Lesson: Matlab Tutorial
1 Matlab Tutorial 2 Lecture Learning Objectives Each student should be able to: Describe the Matlab desktop Explain the basic use of Matlab variables Explain the basic use of Matlab scripts Explain the
More informationSMS 3515: Scientific Computing Lecture 1: Introduction to Matlab 2014
SMS 3515: Scientific Computing Lecture 1: Introduction to Matlab 2014 Instructor: Nurul Farahain Mohammad 1 It s all about MATLAB What is MATLAB? MATLAB is a mathematical and graphical software package
More informationA 30 Minute Introduction to Octave ENGR Engineering Mathematics Tony Richardson
A 30 Minute Introduction to Octave ENGR 390 - Engineering Mathematics Tony Richardson Introduction This is a brief introduction to Octave. It covers several topics related to both the statistics and linear
More informationIntroduction to Matlab. By: Hossein Hamooni Fall 2014
Introduction to Matlab By: Hossein Hamooni Fall 2014 Why Matlab? Data analytics task Large data processing Multi-platform, Multi Format data importing Graphing Modeling Lots of built-in functions for rapid
More informationIntroduction to Matlab
Introduction to Matlab Outline: What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display Facilities Flow Control Using of M-File Writing User
More informationLab of COMP 406. MATLAB: Quick Start. Lab tutor : Gene Yu Zhao Mailbox: or Lab 1: 11th Sep, 2013
Lab of COMP 406 MATLAB: Quick Start Lab tutor : Gene Yu Zhao Mailbox: csyuzhao@comp.polyu.edu.hk or genexinvivian@gmail.com Lab 1: 11th Sep, 2013 1 Where is Matlab? Find the Matlab under the folder 1.
More informationDr Richard Greenaway
SCHOOL OF PHYSICS, ASTRONOMY & MATHEMATICS 4PAM1008 MATLAB 3 Creating, Organising & Processing Data Dr Richard Greenaway 3 Creating, Organising & Processing Data In this Workshop the matrix type is introduced
More informationLecture 15 MATLAB II: Conditional Statements and Arrays
Lecture 15 MATLAB II: Conditional Statements and Arrays 1 Conditional Statements 2 The boolean operators in MATLAB are: > greater than < less than >= greater than or equals
More informationFreeMat Tutorial. 3x + 4y 2z = 5 2x 5y + z = 8 x x + 3y = -1 xx
1 of 9 FreeMat Tutorial FreeMat is a general purpose matrix calculator. It allows you to enter matrices and then perform operations on them in the same way you would write the operations on paper. This
More informationIntroduction to MATLAB
Introduction to MATLAB Introduction MATLAB is an interactive package for numerical analysis, matrix computation, control system design, and linear system analysis and design available on most CAEN platforms
More informationAn Introduction to MATLAB
An Introduction to MATLAB Day 1 Simon Mitchell Simon.Mitchell@ucla.edu High level language Programing language and development environment Built-in development tools Numerical manipulation Plotting of
More informationIntroduction to MATLAB
ELG 3125 - Lab 1 Introduction to MATLAB TA: Chao Wang (cwang103@site.uottawa.ca) 2008 Fall ELG 3125 Signal and System Analysis P. 1 Do You Speak MATLAB? MATLAB - The Language of Technical Computing ELG
More informationMatlab (Matrix laboratory) is an interactive software system for numerical computations and graphics.
Matlab (Matrix laboratory) is an interactive software system for numerical computations and graphics. Starting MATLAB - On a PC, double click the MATLAB icon - On a LINUX/UNIX machine, enter the command:
More informationOUTLINES. Variable names in MATLAB. Matrices, Vectors and Scalar. Entering a vector Colon operator ( : ) Mathematical operations on vectors.
1 LECTURE 3 OUTLINES Variable names in MATLAB Examples Matrices, Vectors and Scalar Scalar Vectors Entering a vector Colon operator ( : ) Mathematical operations on vectors examples 2 VARIABLE NAMES IN
More informationScientific Computing Lecture Series Introduction to MATLAB Programming
Scientific Computing Lecture Series Introduction to MATLAB Programming Hamdullah Yücel * Scientific Computing, Institute of Applied Mathematics Lecture I Basic Commands and Syntax, Arrays and Matrices
More information1 Introduction to MATLAB
1 Introduction to MATLAB 1.1 Quick Overview This chapter is not intended to be a comprehensive manual of MATLAB R. Our sole aim is to provide sufficient information to give you a good start. If you are
More informationIntroduction to. The Help System. Variable and Memory Management. Matrices Generation. Interactive Calculations. Vectors and Matrices
Introduction to Interactive Calculations Matlab is interactive, no need to declare variables >> 2+3*4/2 >> V = 50 >> V + 2 >> V Ans = 52 >> a=5e-3; b=1; a+b Most elementary functions and constants are
More informationMATLAB BASICS. M Files. Objectives
Objectives MATLAB BASICS 1. What is MATLAB and why has it been selected to be the tool of choice for DIP? 2. What programming environment does MATLAB offer? 3. What are M-files? 4. What is the difference
More informationIntroduction to Matlab. By: Dr. Maher O. EL-Ghossain
Introduction to Matlab By: Dr. Maher O. EL-Ghossain Outline: q What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display Facilities Flow Control
More information1 Introduction to MATLAB
1 Introduction to MATLAB 1.1 General Information Quick Overview This chapter is not intended to be a comprehensive manual of MATLAB R. Our sole aim is to provide sufficient information to give you a good
More informationGetting started with MATLAB
Sapienza University of Rome Department of economics and law Advanced Monetary Theory and Policy EPOS 2013/14 Getting started with MATLAB Giovanni Di Bartolomeo giovanni.dibartolomeo@uniroma1.it Outline
More informationMATLAB Basics. Mohamed Taha. Communication Engineering Department Princess Sumaya University Page 1 of 32. Full Screen.
Mohamed Taha Communication Engineering Department Princess Sumaya University mtaha@psut.edu.jo Page 1 of 32 1 What is It is an abbreviation to MATrix LABoratory Front end for a matrix library It is an
More informationIntroduction to MATLAB
CHEE MATLAB Tutorial Introduction to MATLAB Introduction In this tutorial, you will learn how to enter matrices and perform some matrix operations using MATLAB. MATLAB is an interactive program for numerical
More information! The MATLAB language
E2.5 Signals & Systems Introduction to MATLAB! MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to -use environment. Typical
More informationOutline. User-based knn Algorithm Basics of Matlab Control Structures Scripts and Functions Help
Outline User-based knn Algorithm Basics of Matlab Control Structures Scripts and Functions Help User-based knn Algorithm Three main steps Weight all users with respect to similarity with the active user.
More informationMatlab Lecture 1 - Introduction to MATLAB. Five Parts of Matlab. Entering Matrices (2) - Method 1:Direct entry. Entering Matrices (1) - Magic Square
Matlab Lecture 1 - Introduction to MATLAB Five Parts of Matlab MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-touse
More informationTo start using Matlab, you only need be concerned with the command window for now.
Getting Started Current folder window Atop the current folder window, you can see the address field which tells you where you are currently located. In programming, think of it as your current directory,
More informationMATLAB Lecture 1. Introduction to MATLAB
MATLAB Lecture 1. Introduction to MATLAB 1.1 The MATLAB environment MATLAB is a software program that allows you to compute interactively with matrices. If you want to know for instance the product of
More informationECE Lesson Plan - Class 1 Fall, 2001
ECE 201 - Lesson Plan - Class 1 Fall, 2001 Software Development Philosophy Matrix-based numeric computation - MATrix LABoratory High-level programming language - Programming data type specification not
More informationMATLAB: The Basics. Dmitry Adamskiy 9 November 2011
MATLAB: The Basics Dmitry Adamskiy adamskiy@cs.rhul.ac.uk 9 November 2011 1 Starting Up MATLAB Windows users: Start up MATLAB by double clicking on the MATLAB icon. Unix/Linux users: Start up by typing
More informationMBI REU Matlab Tutorial
MBI REU Matlab Tutorial Lecturer: Reginald L. McGee II, Ph.D. June 8, 2017 MATLAB MATrix LABoratory MATLAB is a tool for numerical computation and visualization which allows Real & Complex Arithmetics
More informationFinding, Starting and Using Matlab
Variables and Arrays Finding, Starting and Using Matlab CSC March 6 &, 9 Array: A collection of data values organized into rows and columns, and known by a single name. arr(,) Row Row Row Row 4 Col Col
More informationMATLAB for Experimental Research. Fall 2018 Vectors, Matrices, Matrix Operations
MATLAB for Experimental Research Fall 2018 Vectors, Matrices, Matrix Operations Matlab is more than a calculator! The array is a fundamental form that MATLAB uses to store and manipulate data. An array
More informationMATLAB Tutorial The Basics
MATLAB Tutorial The Basics Chienmin Chuang School of Mathematics, University of Birmingham May 24, 2011 WHAT IS MATLAB? MATLAB, coined from MATrix LABoratory, is a mathematical computing software developed
More informationMAT 343 Laboratory 2 Solving systems in MATLAB and simple programming
MAT 343 Laboratory 2 Solving systems in MATLAB and simple programming In this laboratory session we will learn how to 1. Solve linear systems with MATLAB 2. Create M-files with simple MATLAB codes Backslash
More informationMATLAB Lesson I. Chiara Lelli. October 2, Politecnico di Milano
MATLAB Lesson I Chiara Lelli Politecnico di Milano October 2, 2012 MATLAB MATLAB (MATrix LABoratory) is an interactive software system for: scientific computing statistical analysis vector and matrix computations
More informationLecturer: Keyvan Dehmamy
MATLAB Tutorial Lecturer: Keyvan Dehmamy 1 Topics Introduction Running MATLAB and MATLAB Environment Getting help Variables Vectors, Matrices, and linear Algebra Mathematical Functions and Applications
More informationComputer Programming in MATLAB
Computer Programming in MATLAB Prof. Dr. İrfan KAYMAZ Atatürk University Engineering Faculty Department of Mechanical Engineering What is a computer??? Computer is a device that computes, especially a
More informationLecture 2. Arrays. 1 Introduction
1 Introduction Lecture 2 Arrays As the name Matlab is a contraction of matrix laboratory, you would be correct in assuming that Scilab/Matlab have a particular emphasis on matrices, or more generally,
More informationLAB 2 VECTORS AND MATRICES
EN001-4: Intro to Computational Design Tufts University, Department of Computer Science Prof. Soha Hassoun LAB 2 VECTORS AND MATRICES 1.1 Background Overview of data types Programming languages distinguish
More informationIntroduction to MATLAB. Computational Probability and Statistics CIS 2033 Section 003
Introduction to MATLAB Computational Probability and Statistics CIS 2033 Section 003 About MATLAB MATLAB (MATrix LABoratory) is a high level language made for: Numerical Computation (Technical computing)
More informationPart #1. A0B17MTB Matlab. Miloslav Čapek Filip Kozák, Viktor Adler, Pavel Valtr
A0B17MTB Matlab Part #1 Miloslav Čapek miloslav.capek@fel.cvut.cz Filip Kozák, Viktor Adler, Pavel Valtr Department of Electromagnetic Field B2-626, Prague You will learn Scalars, vectors, matrices (class
More informationMathematics 4330/5344 #1 Matlab and Numerical Approximation
David S. Gilliam Department of Mathematics Texas Tech University Lubbock, TX 79409 806 742-2566 gilliam@texas.math.ttu.edu http://texas.math.ttu.edu/~gilliam Mathematics 4330/5344 #1 Matlab and Numerical
More informationUsing the fprintf command to save output to a file.
Using the fprintf command to save output to a file. In addition to displaying output in the Command Window, the fprintf command can be used for writing the output to a file when it is necessary to save
More informationMATH (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab
MATH 495.3 (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab Below is a screen similar to what you should see when you open Matlab. The command window is the large box to the right containing the
More informationMATLAB COURSE FALL 2004 SESSION 1 GETTING STARTED. Christian Daude 1
MATLAB COURSE FALL 2004 SESSION 1 GETTING STARTED Christian Daude 1 Introduction MATLAB is a software package designed to handle a broad range of mathematical needs one may encounter when doing scientific
More informationIntroduction to MATLAB for Numerical Analysis and Mathematical Modeling. Selis Önel, PhD
Introduction to MATLAB for Numerical Analysis and Mathematical Modeling Selis Önel, PhD Advantages over other programs Contains large number of functions that access numerical libraries (LINPACK, EISPACK)
More informationInteractive Computing with Matlab. Gerald W. Recktenwald Department of Mechanical Engineering Portland State University
Interactive Computing with Matlab Gerald W. Recktenwald Department of Mechanical Engineering Portland State University gerry@me.pdx.edu Starting Matlab Double click on the Matlab icon, or on unix systems
More informationMatlab Workshop I. Niloufer Mackey and Lixin Shen
Matlab Workshop I Niloufer Mackey and Lixin Shen Western Michigan University/ Syracuse University Email: nil.mackey@wmich.edu, lshen03@syr.edu@wmich.edu p.1/13 What is Matlab? Matlab is a commercial Matrix
More informationChapter 1 Introduction to MATLAB
Chapter 1 Introduction to MATLAB 1.1 What is MATLAB? MATLAB = MATrix LABoratory, the language of technical computing, modeling and simulation, data analysis and processing, visualization and graphics,
More informationSECTION 1: INTRODUCTION. ENGR 112 Introduction to Engineering Computing
SECTION 1: INTRODUCTION ENGR 112 Introduction to Engineering Computing 2 Course Overview What is Programming? 3 Programming The implementation of algorithms in a particular computer programming language
More informationAn Introduction to MATLAB and the Control Systems toolbox Aravind Parchuri, Darren Hon and Albert Honein
E205 Introduction to Control Design Techniques An Introduction to MATLAB and the Control Systems toolbox Aravind Parchuri, Darren Hon and Albert Honein MATLAB is essentially a programming interface that
More informationArrays and Matrix Operations
9 Arrays and Matrix Operations 1 THE PRIMARY MATLAB DATA STRUCTURE As we have previously stated, the basic data element in the MATLAB system is the array. A scalar is represented as a 1 * 1 array that
More informationHow to Use MATLAB. What is MATLAB. Getting Started. Online Help. General Purpose Commands
How to Use MATLAB What is MATLAB MATLAB is an interactive package for numerical analysis, matrix computation, control system design and linear system analysis and design. On the server bass, MATLAB version
More informationDr Richard Greenaway
SCHOOL OF PHYSICS, ASTRONOMY & MATHEMATICS 4PAM1008 MATLAB 2 Basic MATLAB Operation Dr Richard Greenaway 2 Basic MATLAB Operation 2.1 Overview 2.1.1 The Command Line In this Workshop you will learn how
More informationInlichtingenblad, matlab- en simulink handleiding en practicumopgaven IWS
Inlichtingenblad, matlab- en simulink handleiding en practicumopgaven IWS 1 6 3 Matlab 3.1 Fundamentals Matlab. The name Matlab stands for matrix laboratory. Main principle. Matlab works with rectangular
More informationRelational and Logical Operators
Relational and Logical Operators Relational Operators Relational operators are used to represent conditions (such as space 0 in the water tank example) Result of the condition is either true or false In
More informationIntroduction to MATLAB Programming
Introduction to MATLAB Programming Arun A. Balakrishnan Asst. Professor Dept. of AE&I, RSET Overview 1 Overview 2 Introduction 3 Getting Started 4 Basics of Programming Overview 1 Overview 2 Introduction
More informationArithmetic operations
Arithmetic operations Add/Subtract: Adds/subtracts vectors (=> the two vectors have to be the same length). >> x=[1 2]; >> y=[1 3]; >> whos Name Size Bytes Class Attributes x 1x2 16 double y 1x2 16 double
More informationIntroduction to MatLab. Introduction to MatLab K. Craig 1
Introduction to MatLab Introduction to MatLab K. Craig 1 MatLab Introduction MatLab and the MatLab Environment Numerical Calculations Basic Plotting and Graphics Matrix Computations and Solving Equations
More informationSome elements for Matlab programming
Some elements for Matlab programming Nathalie Thomas 2018 2019 Matlab, which stands for the abbreviation of MATrix LABoratory, is one of the most popular language for scientic computation. The classical
More informationIntroduction to MATLAB. CS534 Fall 2016
Introduction to MATLAB CS534 Fall 2016 What you'll be learning today MATLAB basics (debugging, IDE) Operators Matrix indexing Image I/O Image display, plotting A lot of demos... Matrices What is a matrix?
More informationExperiment 1: Introduction to MATLAB I. Introduction. 1.1 Objectives and Expectations: 1.2 What is MATLAB?
Experiment 1: Introduction to MATLAB I Introduction MATLAB, which stands for Matrix Laboratory, is a very powerful program for performing numerical and symbolic calculations, and is widely used in science
More informationIntroduction to MATLAB
Chapter 1 Introduction to MATLAB 1.1 Software Philosophy Matrix-based numeric computation MATrix LABoratory built-in support for standard matrix and vector operations High-level programming language Programming
More informationMost nonzero floating-point numbers are normalized. This means they can be expressed as. x = ±(1 + f) 2 e. 0 f < 1
Floating-Point Arithmetic Numerical Analysis uses floating-point arithmetic, but it is just one tool in numerical computation. There is an impression that floating point arithmetic is unpredictable and
More informationMAT 275 Laboratory 2 Matrix Computations and Programming in MATLAB
MATLAB sessions: Laboratory MAT 75 Laboratory Matrix Computations and Programming in MATLAB In this laboratory session we will learn how to. Create and manipulate matrices and vectors.. Write simple programs
More informationMATLAB TUTORIAL FOR MATH/CHEG 305
MATLAB TUTORIAL FOR MATH/CHEG 305 February 1, 2002 Contents 1 Starting Matlab 2 2 Entering Matrices, Basic Operations 2 3 Editing Command Lines 4 4 Getting Help 4 5 Interrupting, Quitting Matlab 5 6 Special
More informationComputer Packet 1 Row Operations + Freemat
Computer Packet 1 Row Operations + Freemat For this packet, you will use a website to do row operations, and then learn to use a general purpose matrix calculator called FreeMat. To reach the row operations
More informationA GUIDE FOR USING MATLAB IN COMPUTER SCIENCE AND COMPUTER ENGINEERING TABLE OF CONTENTS
A GUIDE FOR USING MATLAB IN COMPUTER SCIENCE AND COMPUTER ENGINEERING MARC THOMAS AND CHRISTOPHER PASCUA TABLE OF CONTENTS 1. Language Usage and Matlab Interface 1 2. Matlab Global Syntax and Semantic
More information(Creating Arrays & Matrices) Applied Linear Algebra in Geoscience Using MATLAB
Applied Linear Algebra in Geoscience Using MATLAB (Creating Arrays & Matrices) Contents Getting Started Creating Arrays Mathematical Operations with Arrays Using Script Files and Managing Data Two-Dimensional
More informationMATLAB Basics. Configure a MATLAB Package 6/7/2017. Stanley Liang, PhD York University. Get a MATLAB Student License on Matworks
MATLAB Basics Stanley Liang, PhD York University Configure a MATLAB Package Get a MATLAB Student License on Matworks Visit MathWorks at https://www.mathworks.com/ It is recommended signing up with a student
More informationMATLAB. Devon Cormack and James Staley
MATLAB Devon Cormack and James Staley MATrix LABoratory Originally developed in 1970s as a FORTRAN wrapper, later rewritten in C Designed for the purpose of high-level numerical computation, visualization,
More informationComputer Vision. Matlab
Computer Vision Matlab A good choice for vision program development because Easy to do very rapid prototyping Quick to learn, and good documentation A good library of image processing functions Excellent
More informationDigital Image Processing
Digital Image Processing Introduction to MATLAB Hanan Hardan 1 Background on MATLAB (Definition) MATLAB is a high-performance language for technical computing. The name MATLAB is an interactive system
More information2.0 MATLAB Fundamentals
2.0 MATLAB Fundamentals 2.1 INTRODUCTION MATLAB is a computer program for computing scientific and engineering problems that can be expressed in mathematical form. The name MATLAB stands for MATrix LABoratory,
More informationProgramming in Mathematics. Mili I. Shah
Programming in Mathematics Mili I. Shah Starting Matlab Go to http://www.loyola.edu/moresoftware/ and login with your Loyola name and password... Matlab has eight main windows: Command Window Figure Window
More informationFloating-point representation
Lecture 3-4: Floating-point representation and arithmetic Floating-point representation The notion of real numbers in mathematics is convenient for hand computations and formula manipulations. However,
More informationMATLAB = MATrix LABoratory. Interactive system. Basic data element is an array that does not require dimensioning.
Introduction MATLAB = MATrix LABoratory Interactive system. Basic data element is an array that does not require dimensioning. Efficient computation of matrix and vector formulations (in terms of writing
More informationME305: Introduction to System Dynamics
ME305: Introduction to System Dynamics Using MATLAB MATLAB stands for MATrix LABoratory and is a powerful tool for general scientific and engineering computations. Combining with user-friendly graphics
More informationMatlab is a tool to make our life easier. Keep that in mind. The best way to learn Matlab is through examples, at the computer.
Learn by doing! The purpose of this tutorial is to provide an introduction to Matlab, a powerful software package that performs numeric computations. The examples should be run as the tutorial is followed.
More informationIdentity Matrix: >> eye(3) ans = Matrix of Ones: >> ones(2,3) ans =
Very Basic MATLAB Peter J. Olver January, 2009 Matrices: Type your matrix as follows: Use space or, to separate entries, and ; or return after each row. >> [;5 0-3 6;; - 5 ] or >> [,5,6,-9;5,0,-3,6;7,8,5,0;-,,5,]
More informationA Quick Tutorial on MATLAB. Zeeshan Ali
A Quick Tutorial on MATLAB Zeeshan Ali MATLAB MATLAB is a software package for doing numerical computation. It was originally designed for solving linear algebra type problems using matrices. It's name
More informationIntroduction to Matlab
Introduction to Matlab 1 Outline: What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display Facilities Flow Control Using of M-File Writing User
More information2 Computation with Floating-Point Numbers
2 Computation with Floating-Point Numbers 2.1 Floating-Point Representation The notion of real numbers in mathematics is convenient for hand computations and formula manipulations. However, real numbers
More informationMATLAB Tutorial. 1. The MATLAB Windows. 2. The Command Windows. 3. Simple scalar or number operations
MATLAB Tutorial The following tutorial has been compiled from several resources including the online Help menu of MATLAB. It contains a list of commands that will be directly helpful for understanding
More informationMATLAB Tutorial. Digital Signal Processing. Course Details. Topics. MATLAB Environment. Introduction. Digital Signal Processing (DSP)
Digital Signal Processing Prof. Nizamettin AYDIN naydin@yildiz.edu.tr naydin@ieee.org http://www.yildiz.edu.tr/~naydin Course Details Course Code : 0113620 Course Name: Digital Signal Processing (Sayısal
More information