Introduction and MATLAB Basics
|
|
- Lillian Thompson
- 6 years ago
- Views:
Transcription
1 Introduction and MATLAB Basics
2 Lecture Computer Room
3 MATLAB MATLAB: Matrix Laboratory, designed for matrix manipulation Pro: Con: Syntax similar to C/C++/Java Automated memory management Dynamic data types Single instructions manipulate entire vectors and matrices A wide range of libraries for signal processing, visualisation, machine learning... Platform independent, inclusion of C/C++/Java/... modules possible Costs money Uses lots of memory Can be slow for certain types of problems Further information in the tutorial: the MATLAB Help System!
4
5 Variables a = 5 a = 5 Scalars a = 5; a a = 5 (Semicolon suppresses output) Elements of a row are separated by commas a = [1,2,3] a = Matrices Rows are separated by semicolons a = [1,2,3; 4,5,6] a =
6 Basic Datatypes double: Floating point number, the most common datatype in MATLAB Other numeric datatypes: float, int32, uint8,... rather uncommon a = 1; whos('a'); Name Size Bytes Class a 1x1 8 double array Grand total is 1 element using 8 bytes Complex numbers a = complex(1,-2) a = i a = 1-2*i a = i Warning: i can be redefined (overwritten)! Strings a = ['test123', '456'] a = test123456
7 Advanced Datatypes Cell Arrays: Generalised matrix Elements can have differing datatypes Elements can have different sizes a = {[1,2,3], 'test123'} a = [1x3 double] 'test123' Structures Combine various data in a 'field/value' type structure Fields and associated datatypes do not have to be declared (and can change at run-time) a.b = 2; a.c = [2,3,4]; a a = b: 2 c: [2 3 4]
8 Arithmetic Operators 1 Addition and subtraction a = 5; b=6; a + b 11 a = [1,2,3; 4,5,6]; b = [0,1,2; 3,4,5]; a - b Matrices must have the same size to be added or subtracted Exception: Scalars can be added to matrices a = [1,2; 3,4]; b = [1;2;3]; a + b??? Error using ==> plus Matrix dimensions must agree. a = [1,2; 3,4]; a
9 Arithmetic Operators 2 The * operator is used for matrix multiplication a = 5; b = 6; a * b 30 a = [1,2; 3,4]; a * a = [0,1; 1,0]; b = [1;2]; a * b 2 1 The.* operator multiplies corresponding elements of the operands a = [1; 2]; b = [2; 1]; a.* b 2 2
10 Arithmetic Operators 3 Division with / has the expected effect for scalars a = 2; b = 3; a / b In the case of matrices, the./ operator causes element-wise division a = 2; b = [1,2; 3,4]; a./ b a = [1,2; 3,4]; b = [2,1; 1,2]; a./ b Matrices can also be divided using the / operator. This operation solves the system of linear equations associated with the matrices involved
11 Arithmetic Operators 4 Scalars and matrices can be raised to a power using ^ and.^ respectively a = 5; a ^ 2 25 a = [1,2; 3,4]; a.^ For matrices, the ^ operator is equivalent to repeated matrix multiplication a = [1,2; 3,4]; a ^ 3 a = [1,2; 3,4]; a * a * a
12 Logical Operators In MATLAB, True and False are represented by 1 and 0, repectively The operators {==, ~=} test the operands for equality a = 3; a == 0 a = 3; a ~= The operators{>, <, >=, <=} compare the magnitudes of operands a = 5; a < 3 a = 5; a >= All logical operators can be applied to matrices, where they act on each element a = [1,2; 3,4]; a = [1,2; 3,4]; b = [1,0; 3,0]; a == 3 a > b
13 Working with Matrices 1 Matrices do not have to be created by explicitly listing their contents ones(rows, columns) initialises a matrix of ones zeros(rows, columns) initialises a matrix of zeros ones(2,3) zeros(2,3) zeros and ones can also be used to create higher dimensional (3D,4D etc.) matrices a:b initialises a vector [a, a+1, a+2,..., b] a:c:b initialises a vector [a, a+c, a+2*c,..., b] 1:5 2:-0.5:
14 Working with Matrices 2 MATLAB indices start at 1 a(y,x) is the value of a in row y and column x a = [1,2; 3,4]; a(2,1) 3 Several matrix locations can be accessed simultaneously using lists of indices The special index : accesses an entire dimension of a matrix a = [1,2; 3,4]; a = [1,2; 3,4]; a = [1,2; 3,4]; a([1,2],2) a(1:2,2) a(:,2) Elements in a matrix can be addressed using only a single index (see Linear Indexing in the MATLAB Help system)
15 Working with Matrices 3 The ' operator transposes a matrix and (complex) conjugates each element a = [1,2; 3,4]; a = [1,2; 3,4]; a a' a = The size function determines the size of a matrix a = ones(10,100); size(a) Other important functions include: min, max: Find the minimal/maximal value in a vector sum: Sum the elements of a vector mean, std: Mean and standard deviation in a vector find: Find the indices of elements that satisfy a certain condition abs: Compute the absolute value
16 Flow Control 1 Conditional statements use if if Syntax if logical-value Instruction 1 Instruction 2... else Instruction 3 Instruction 4... end If Example a = 1; if (a >= 0) disp('a ist > 0!'); end a ist > 0! The else part of an if statement is optional A sequence of if statements can often be replaced by a single switch statement (see MATLAB Help!)
17 Flow Control 2 for Syntax for Variable = List Instruction 1 Instruction 2... end for Loops for Example 1 for i=[2,4,6] disp(i); end while Loops for Example 2 for i=1:3 disp(2*i); end while Example whlie Syntax while Condition Instruction 1 Instruction 2... end a = 6; while (a > 0) disp(a); a = a-4; end 6 2
18 Writing Functions 1 New (user defined) functions are defined in.m files The file name has to correspond to the function name E.g. the function myfunc is defined in myfunc.m New.m Files can be created using the menu item File -> New -> M-File Several functions can be defined in a single.m file, however only the main program is visible to the outside Important MATLAB will only find your.m file if the directory containing it is either set as the Current Directory in the main window or is permanently added to the search path using File -> Set Path...
19 Writing Functions 2 A function begins with a declaration that contains the function name and lists inputs (parameters) and outputs: function [output1, output2, output3,... ]=Name(input1, input2,... ) output1, output2...: The outputs, or results, of the function input1, input2...: The input parameters to the function Name: The name of the function A very simple MATLAB function could be the following: % Function test1: % Computes the sum of in1 and in2 function [out]=test1(in1, in2) out = in1 + in2; end Comments in MATLAB Programms begin with %, as shown above
20 Writing Functions 3 Functions can be executed in the MATLAB main window total = test1(5,6); total 11 Several outputs are possible by simply assigning values to all output variables: % Function test2: % Computes the sum and the difference of in1 und in2 function [out1, out2]=test2(in1, in2) out1 = in1 + in2; out2 = in1 - in2; end Not all outputs of a function have to be used (assigned) by the caller summe = test2(5,6); [summe, diff] = test2(5,6);
21 Graphics The figure command opens a new window for graphical output figure The close command closes the currently active figure
22 plot plot([-5:5].^2) title('parabola') xlabel('x') ylabel('y') legend('x^2') x = cos(0:0.1:2*pi) y = sin(0:0.1:2*pi) plot(x,y)
23 imshow imshow(diag(0:200),[ ]) colorbar imshow displays matrices as images The empty square braces indicate that intensities are automatically scaled (minimum and maximum become black and white, respectively) The example above displays a matrix with the values [0:200] on the diagonal imshow can also display colour images
24 imread & subplot rgb = imread('img/desert.jpg'); grau = rgb2gray(rgb); subplot(2,1,1) imshow(rgb) subplot(2,1,2) imshow(grau) imread reads an image from a file In the case of colour images, the result is a 3D matrix with RGB values rgb2gray converts colour images to grayscale subplot is used to display several graphics outputs in a single window For image processing and analysis, it is almost always necessary to cast grayscale values to the 'double' datatype: rgb = imread('img/desert.jpg'); grau = double(rgb2gray(rgb));
25 Breakpoints The execution of a function can be halted at arbitrary points using breakpoints The contents of variables at the breakpoint in the function can be viewed and changed This is often usefull when debugging functions test1([1,2], ones(2))??? Error using ==> plus Matrix dimensions must agree. Breakpoints are enabled by clicking on the '-' marker at the beginning of a line Error in ==> test1 at 5 out = in1 + in2; test1([1,2], ones(2)) 5 out = in1 + in2; K in1, in2 in1 = 1 2 in2 =
26 Automatically Switching to Debug Mode MATLAB can be configured to switch to debug mode automatically, as soon as an error occurs Usefull when there are several potential sources of errors (The Debug menu in the main window) (Enable the debug mode automatically in case of an error)
27 Exercises MATLAB is optimised for the manipulation of matrices Loops in which elements of a matrix are processed individually are very slow Good MATLAB programs therefore avoid loops all together Surprisingly many problems can be solved by manipulating entire matrices without explicit iteration, even when the solution is sometimes more memory intensive The aim of this exercise is, therefore, to solve a number of simple and not so simple tasks without using explicit loops over matrices (i.e. no for or while loops allowed!) The following slides describe the prototypes of the functions to be implemented
28 function splitshow(imga,imgb) A processed image (imgb) is to be compared with the original (imga) Both images are cut in half and concatenated to make their comparison easy Both intensities in both images need to be scaled such that their gray values lie in the same range before the two image halves are concatenated imga = imread('img/desert.jpg'); imga = double(rgb2gray(imga)); imgb = edge(imga,'canny'); splitshow(imga,imgb)
29 function [n]=matchcount(a,num) Function matchcount counts how often a given number num occurs in matrix A A = [1,2; 2,3] A = matchcount(a,2) A = [1,2; 2,3] A = matchcount(a,1) 2 1
30 function [A]=replicate(vect, num) The vector vect is repeated num times to produce matrix A vect can be a row-vector or a column-vector Do not use the MATLAB repmat function! a = [1,2,3,4] a = replicate(a,5) a = [1;2;3;4] a = replicate(a,5)
31 function [circ]=circle(radius) circle computes a quadratic matrix circ with (2*radius+1) rows and columns circ contains a region of 1s in the shape of a circle (of radius radius) Hint: Begin by computing a matrix of distances to the centre element of the matrix circle(4) The replicate function could come in handy Example Distances for radius = imshow(circle(100),[])
Introduction 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 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 informationMATLAB SUMMARY FOR MATH2070/2970
MATLAB SUMMARY FOR MATH2070/2970 DUNCAN SUTHERLAND 1. Introduction The following is inted as a guide containing all relevant Matlab commands and concepts for MATH2070 and 2970. All code fragments should
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 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 informationMatlab Introduction. Scalar Variables and Arithmetic Operators
Matlab Introduction Matlab is both a powerful computational environment and a programming language that easily handles matrix and complex arithmetic. It is a large software package that has many advanced
More informationIntroduction to Matlab/Octave
Introduction to Matlab/Octave February 28, 2014 This document is designed as a quick introduction for those of you who have never used the Matlab/Octave language, as well as those of you who have used
More informationEric W. Hansen. The basic data type is a matrix This is the basic paradigm for computation with MATLAB, and the key to its power. Here s an example:
Using MATLAB for Stochastic Simulation. Eric W. Hansen. Matlab Basics Introduction MATLAB (MATrix LABoratory) is a software package designed for efficient, reliable numerical computing. Using MATLAB greatly
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 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 informationMATLAB for beginners. KiJung Yoon, 1. 1 Center for Learning and Memory, University of Texas at Austin, Austin, TX 78712, USA
MATLAB for beginners KiJung Yoon, 1 1 Center for Learning and Memory, University of Texas at Austin, Austin, TX 78712, USA 1 MATLAB Tutorial I What is a matrix? 1) A way of representation for data (# of
More informationAN INTRODUCTION TO MATLAB
AN INTRODUCTION TO MATLAB 1 Introduction MATLAB is a powerful mathematical tool used for a number of engineering applications such as communication engineering, digital signal processing, control engineering,
More informationVector: A series of scalars contained in a column or row. Dimensions: How many rows and columns a vector or matrix has.
ASSIGNMENT 0 Introduction to Linear Algebra (Basics of vectors and matrices) Due 3:30 PM, Tuesday, October 10 th. Assignments should be submitted via e-mail to: matlabfun.ucsd@gmail.com You can also submit
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 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 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 informationMathematical Operations with Arrays and Matrices
Mathematical Operations with Arrays and Matrices Array Operators (element-by-element) (important) + Addition A+B adds B and A - Subtraction A-B subtracts B from A.* Element-wise multiplication.^ Element-wise
More informationIntroduction to Matlab
Introduction to Matlab Andreas C. Kapourani (Credit: Steve Renals & Iain Murray) 9 January 08 Introduction MATLAB is a programming language that grew out of the need to process matrices. It is used extensively
More informationMatlab notes Matlab is a matrix-based, high-performance language for technical computing It integrates computation, visualisation and programming usin
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
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 informationfunction [s p] = sumprod (f, g)
Outline of the Lecture Introduction to M-function programming Matlab Programming Example Relational operators Logical Operators Matlab Flow control structures Introduction to M-function programming M-files:
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 informationComputational Modelling 102 (Scientific Programming) Tutorials
COMO 102 : Scientific Programming, Tutorials 2003 1 Computational Modelling 102 (Scientific Programming) Tutorials Dr J. D. Enlow Last modified August 18, 2003. Contents Tutorial 1 : Introduction 3 Tutorial
More informationIntroduction to MATLAB Practical 1
Introduction to MATLAB Practical 1 Daniel Carrera November 2016 1 Introduction I believe that the best way to learn Matlab is hands on, and I tried to design this practical that way. I assume no prior
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 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 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 informationWhat is MATLAB? What is MATLAB? Programming Environment MATLAB PROGRAMMING. Stands for MATrix LABoratory. A programming environment
What is MATLAB? MATLAB PROGRAMMING Stands for MATrix LABoratory A software built around vectors and matrices A great tool for numerical computation of mathematical problems, such as Calculus Has powerful
More informationImage Processing Matlab tutorial 2 MATLAB PROGRAMMING
School of Engineering and Physical Sciences Electrical Electronic and Computer Engineering Image Processing Matlab tutorial 2 MATLAB PROGRAMMING 1. Objectives: Last week, we introduced you to the basic
More informationA Quick Introduction to MATLAB/Octave. Kenny Marino, Nupur Chatterji
A Quick Introduction to MATLAB/Octave Kenny Marino, Nupur Chatterji Basics MATLAB (and it s free cousin Octave) is an interpreted language Two basic kinds of files Scripts Functions MATLAB is optimized
More informationCS1114: Matlab Introduction
CS1114: Matlab Introduction 1 Introduction The purpose of this introduction is to provide you a brief introduction to the features of Matlab that will be most relevant to your work in this course. Even
More informationImage Processing CS 6640 : An Introduction to MATLAB Basics Bo Wang and Avantika Vardhan
Image Processing CS 6640 : An Introduction to MATLAB Basics Bo Wang and Avantika Vardhan August 29, 2014 1 Getting Started with MATLAB 1.1 Resources 1) CADE Lab: Matlab is installed on all the CADE lab
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 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 informationPhysics 326G Winter Class 2. In this class you will learn how to define and work with arrays or vectors.
Physics 326G Winter 2008 Class 2 In this class you will learn how to define and work with arrays or vectors. Matlab is designed to work with arrays. An array is a list of numbers (or other things) arranged
More informationIntroduction to Matlab
Introduction to Matlab Enrique Muñoz Ballester Dipartimento di Informatica via Bramante 65, 26013 Crema (CR), Italy enrique.munoz@unimi.it Contact Email: enrique.munoz@unimi.it Office: Room BT-43 Industrial,
More informationCSE/Math 485 Matlab Tutorial and Demo
CSE/Math 485 Matlab Tutorial and Demo Some Tutorial Information on MATLAB Matrices are the main data element. They can be introduced in the following four ways. 1. As an explicit list of elements. 2. Generated
More informationCompact Matlab Course
Compact Matlab Course MLC.1 15.04.2014 Matlab Command Window Workspace Command History Directories MLC.2 15.04.2014 Matlab Editor Cursor in Statement F1 Key goes to Help Information MLC.3 15.04.2014 Elementary
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 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 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 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 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 informationIntroduction to MATLAB programming: Fundamentals
Introduction to MATLAB programming: Fundamentals Shan He School for Computational Science University of Birmingham Module 06-23836: Computational Modelling with MATLAB Outline Outline of Topics Why MATLAB?
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 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 informationCS1114: Matlab Introduction
CS1114: Matlab Introduction 1 Introduction The purpose of this introduction is to provide you a brief introduction to the features of Matlab that will be most relevant to your work in this course. Even
More informationMATLAB GUIDE UMD PHYS401 SPRING 2012
MATLAB GUIDE UMD PHYS40 SPRING 202 We will be using Matlab (or, equivalently, the free clone GNU/Octave) this semester to perform calculations involving matrices and vectors. This guide gives a brief introduction
More informationIntroduction to Matlab
What is Matlab? Introduction to Matlab Matlab is software written by a company called The Mathworks (mathworks.com), and was first created in 1984 to be a nice front end to the numerical routines created
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 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 informationVectors and Matrices. Chapter 2. Linguaggio Programmazione Matlab-Simulink (2017/2018)
Vectors and Matrices Chapter 2 Linguaggio Programmazione Matlab-Simulink (2017/2018) Matrices A matrix is used to store a set of values of the same type; every value is stored in an element MATLAB stands
More informationMatlab Tutorial 1: Working with variables, arrays, and plotting
Matlab Tutorial 1: Working with variables, arrays, and plotting Setting up Matlab First of all, let's make sure we all have the same layout of the different windows in Matlab. Go to Home Layout Default.
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 information1 Introduction to Matlab
1 Introduction to Matlab 1. What is Matlab? Matlab is a computer program designed to do mathematics. You might think of it as a super-calculator. That is, once Matlab has been started, you can enter computations,
More informationProgramming 1. Script files. help cd Example:
Programming Until now we worked with Matlab interactively, executing simple statements line by line, often reentering the same sequences of commands. Alternatively, we can store the Matlab input commands
More informationIntroduction to MATLAB. Simon O Keefe Non-Standard Computation Group
Introduction to MATLAB Simon O Keefe Non-Standard Computation Group sok@cs.york.ac.uk Content n An introduction to MATLAB n The MATLAB interfaces n Variables, vectors and matrices n Using operators n Using
More informationIntroduction to Octave/Matlab. Deployment of Telecommunication Infrastructures
Introduction to Octave/Matlab Deployment of Telecommunication Infrastructures 1 What is Octave? Software for numerical computations and graphics Particularly designed for matrix computations Solving equations,
More informationIntroduction to MATLAB
Computational Photonics, Seminar 0 on Introduction into MATLAB, 3.04.08 Page Introduction to MATLAB Operations on scalar variables >> 6 6 Pay attention to the output in the command window >> b = b = >>
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 information50 Basic Examples for Matlab
50 Basic Examples for Matlab v. 2012.3 by HP Huang (typos corrected, 10/2/2012) Supplementary material for MAE384, 502, 578, 598 1 Ex. 1 Write your first Matlab program a = 3; b = 5; c = a+b 8 Part 1.
More informationAn Introduction to MATLAB II
Lab of COMP 319 An Introduction to MATLAB II Lab tutor : Gene Yu Zhao Mailbox: csyuzhao@comp.polyu.edu.hk or genexinvivian@gmail.com Lab 2: 16th Sep, 2013 1 Outline of Lab 2 Review of Lab 1 Matrix in Matlab
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 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 informationObjectives. 1 Running, and Interface Layout. 2 Toolboxes, Documentation and Tutorials. 3 Basic Calculations. PS 12a Laboratory 1 Spring 2014
PS 12a Laboratory 1 Spring 2014 Objectives This session is a tutorial designed to a very quick overview of some of the numerical skills that you ll need to get started. Throughout the tutorial, the instructors
More informationHow to learn MATLAB? Some predefined variables
ECE-S352 Lab 1 MATLAB Tutorial How to learn MATLAB? 1. MATLAB comes with good tutorial and detailed documents. a) Select MATLAB help from the MATLAB Help menu to open the help window. Follow MATLAB s Getting
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 informationAMATH 352: MATLAB Tutorial written by Peter Blossey Department of Applied Mathematics University of Washington Seattle, WA
AMATH 352: MATLAB Tutorial written by Peter Blossey Department of Applied Mathematics University of Washington Seattle, WA MATLAB (short for MATrix LABoratory) is a very useful piece of software for numerical
More informationComputational Photonics, Seminar 01 on Introduction into MATLAB, Page 1
Computational Photonics, Seminar 0 on Introduction into MATLAB,.04.06 Page Introduction to MATLAB Operations on scalar variables >> a=6 6 Pay attention to the response from the workspace >> b= b = >> a+b
More informationMATLAB INTRODUCTION. Risk analysis lab Ceffer Attila. PhD student BUTE Department Of Networked Systems and Services
MATLAB INTRODUCTION Risk analysis lab 2018 2018. szeptember 10., Budapest Ceffer Attila PhD student BUTE Department Of Networked Systems and Services ceffer@hit.bme.hu Előadó képe MATLAB Introduction 2
More informationMATLAB for Image Processing
MATLAB for Image Processing PPT adapted from Tuo Wang, tuowang@cs.wisc.edu Computer Vision Lecture Notes 03 1 Introduction to MATLAB Basics & Examples Computer Vision Lecture Notes 03 2 What is MATLAB?
More informationCS100R: Matlab Introduction
CS100R: Matlab Introduction August 25, 2007 1 Introduction The purpose of this introduction is to provide you a brief introduction to the features of Matlab that will be most relevant to your work in this
More informationint16 map is often stored with an indexed image and is automatically loaded with image when using imread
Dr. Qadri Hamarsheh Outline of the Lecture Image Types Converting between data classes and image types Converting images using IPT Function Matlab image Arithmetic Functions Array indexing Image Types
More informationMatlab Primer. Lecture 02a Optical Sciences 330 Physical Optics II William J. Dallas January 12, 2005
Matlab Primer Lecture 02a Optical Sciences 330 Physical Optics II William J. Dallas January 12, 2005 Introduction The title MATLAB stands for Matrix Laboratory. This software package (from The Math Works,
More informationLaboratory 1 Octave Tutorial
Signals, Spectra and Signal Processing Laboratory 1 Octave Tutorial 1.1 Introduction The purpose of this lab 1 is to become familiar with the GNU Octave 2 software environment. 1.2 Octave Review All laboratory
More informationMatlab Tutorial. The value assigned to a variable can be checked by simply typing in the variable name:
1 Matlab Tutorial 1- What is Matlab? Matlab is a powerful tool for almost any kind of mathematical application. It enables one to develop programs with a high degree of functionality. The user can write
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 informationWhat is Matlab? The command line Variables Operators Functions
What is Matlab? The command line Variables Operators Functions Vectors Matrices Control Structures Programming in Matlab Graphics and Plotting A numerical computing environment Simple and effective programming
More informationQUICK INTRODUCTION TO MATLAB PART I
QUICK INTRODUCTION TO MATLAB PART I Department of Mathematics University of Colorado at Colorado Springs General Remarks This worksheet is designed for use with MATLAB version 6.5 or later. Once you have
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 informationMATLAB GUIDE UMD PHYS375 FALL 2010
MATLAB GUIDE UMD PHYS375 FALL 200 DIRECTORIES Find the current directory you are in: >> pwd C:\Documents and Settings\ian\My Documents\MATLAB [Note that Matlab assigned this string of characters to a variable
More informationAppendix A. Introduction to MATLAB. A.1 What Is MATLAB?
Appendix A Introduction to MATLAB A.1 What Is MATLAB? MATLAB is a technical computing environment developed by The Math- Works, Inc. for computation and data visualization. It is both an interactive system
More informationMATLAB GUIDE UMD PHYS401 SPRING 2011
MATLAB GUIDE UMD PHYS401 SPRING 2011 Note that it is sometimes useful to add comments to your commands. You can do this with % : >> data=[3 5 9 6] %here is my comment data = 3 5 9 6 At any time you can
More informationCS313D: ADVANCED PROGRAMMING LANGUAGE
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 2 : C# Language Basics Lecture Contents 2 The C# language First program Variables and constants Input/output Expressions and casting
More informationMATLAB TUTORIAL WORKSHEET
MATLAB TUTORIAL WORKSHEET What is MATLAB? Software package used for computation High-level programming language with easy to use interactive environment Access MATLAB at Tufts here: https://it.tufts.edu/sw-matlabstudent
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 informationCS129: Introduction to Matlab (Code)
CS129: Introduction to Matlab (Code) intro.m Introduction to Matlab (adapted from http://www.stanford.edu/class/cs223b/matlabintro.html) Stefan Roth , 09/08/2003 Stolen
More informationThe Mathematics of Big Data
The Mathematics of Big Data Linear Algebra and MATLAB Philippe B. Laval KSU Fall 2015 Philippe B. Laval (KSU) Linear Algebra and MATLAB Fall 2015 1 / 23 Introduction We introduce the features of MATLAB
More informationUniversity of Alberta
A Brief Introduction to MATLAB University of Alberta M.G. Lipsett 2008 MATLAB is an interactive program for numerical computation and data visualization, used extensively by engineers for analysis of systems.
More informationMatlab Tutorial. Get familiar with MATLAB by using tutorials and demos found in MATLAB. You can click Start MATLAB Demos to start the help screen.
University of Illinois at Urbana-Champaign Department of Electrical and Computer Engineering ECE 298JA Fall 2015 Matlab Tutorial 1 Overview The goal of this tutorial is to help you get familiar with MATLAB
More informationIntroduction. Matlab for Psychologists. Overview. Coding v. button clicking. Hello, nice to meet you. Variables
Introduction Matlab for Psychologists Matlab is a language Simple rules for grammar Learn by using them There are many different ways to do each task Don t start from scratch - build on what other people
More informationIntro To MATLAB. CS Fall 2013 Zach Welch
Intro To MATLAB CS 534 - Fall 2013 Zach Welch Overview Basics MATLAB data structures Operations Useful functions Image Processing and other useful things for 534 Demo Q&A Accessing MATLAB MATLAB is available
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 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 informationIntroduction to Scicoslab
Introduction to Scicoslab Introduction Scicoslab is an open source alternative for modeling and simulation of dynamical system Latest version 4.4 can be downloaded from http://www.scicoslab.org/ getting
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 informationLecture 2 Arrays, Searching and Sorting (Arrays, multi-dimensional Arrays)
Lecture 2 Arrays, Searching and Sorting (Arrays, multi-dimensional Arrays) In this lecture, you will: Learn about arrays Explore how to declare and manipulate data into arrays Understand the meaning of
More informationMore on Images and Matlab
More on Images and Matlab Prof. Eric Miller elmiller@ece.tufts.edu Fall 2007 EN 74-ECE Image Processing Lecture 3-1 Matlab Data Types Different means of representing numbers depending on what you want
More informationMatlab and Octave: Quick Introduction and Examples 1 Basics
Matlab and Octave: Quick Introduction and Examples 1 Basics 1.1 Syntax and m-files There is a shell where commands can be written in. All commands must either be built-in commands, functions, names of
More informationLab Manual. ISC 115 Computing Foundations. Information Technology Solutions
Kuwait University Information Technology Solutions College of Computing Sciences and Engineering Department of Information Science Lab Manual ISC 115 Computing Foundations Prepared by Professor Mostafa
More information