Intro to Matlab Yipei Wang & Qihui Li {yipeiw,

Slides:



Advertisements
Similar presentations
StatLab Workshop Yale University Maximiliano Appendino, Economics October 18 th, 2013.
Advertisements

COMP 116: Introduction to Scientific Programming Lecture 37: Final Review.
Introduction to Matlab
AMS597 Spring 2011 Hao Han April 05, Introduction to MATLAB The name MATLAB stands for MATrix LABoratory. Typical uses include:  Math and computation.
1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 10.
Introduction to Matlab Workshop Matthew Johnson, Economics October 17, /13/20151.
MATLAB – What is it? Computing environment / programming language Tool for manipulating matrices Many applications, you just need to get some numbers in.
MATLAB - Basics Centro de Informática Universidade Federal de Pernambuco Aprendizagem de Máquina – IN1102 Arley Ristar –
CS231A Matlab Tutorial Philip Lee Winter Overview  Goals › Introduction to Matlab › Matlab Snippets › Basic image manipulations › Helpful Matlab.
Matrices and arrays Pekar Miriam. What is matrices? In MATLAB environment, a matrix is a rectangular array of number Vector - 1 by 1 row/ column matrix.
Yuval Hart, Weizmann 2010 © 1 Introduction to Matlab & Data Analysis Tutorial 2 and 3: Variables and Matrix Manipulation.
Eilon Sharon, Weizmann 2008 © 1 Introduction to Matlab & Data Analysis Tutorial 2: Variables and Matrix Manipulation.
Lecture 7 Sept 19, 11 Goals: two-dimensional arrays (continued) matrix operations circuit analysis using Matlab image processing – simple examples Chapter.
Lecture 6 Sept 15, 09 Goals: two-dimensional arrays matrix operations circuit analysis using Matlab image processing – simple examples.
Concatenation MATLAB lets you construct a new vector by concatenating other vectors: – A = [B C D... X Y Z] where the individual items in the brackets.
Introduction to Matlab 7 Part I 1Daniel Baur / Introduction to Matlab Part I Daniel Baur ETH Zurich, Institut für Chemie- und Bioingenieurwissenschaften.
C ENTER FOR I NTEGRATED R ESEARCH C OMPUTING MATLAB
Introduction to MATLAB MECH 300H Spring Starting of MATLAB.
MATLAB FOR PATTERN RECOGNITION By: Özge Öztimur. How Much Do We Know? Anybody who has never used MATLAB?
3-Introduction to MATLAB Dr. Ahmet Zafer Şenalp Mechanical Engineering Department Gebze Technical.
Matlab tutorial course Lesson 2: Arrays and data types
Martin Ellison University of Warwick and CEPR Bank of England, December 2005 Introduction to MATLAB.
Nonparametric Econometrics1 Intro to Matlab for Data Analysis and Statistical Modeling.
Introduction to Matlab 1. Outline: What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators Plotting Flow Control Using of M-File Writing.
Introduction to MATLAB
732A44 Programming in R.  Self-studies of the course book  2 Lectures (1 in the beginning, 1 in the end)  Labs (computer). Compulsory submission of.
Introduction to MATLAB. Windows in MATLAB Command Window – where you enter data, run MATLAB code, and display results Command History - displays a log.
1 Lab of COMP 406 Teaching Assistant: Pei-Yuan Zhou Contact: Lab 1: 12 Sep., 2014 Introduction of Matlab (I)
MEGN 536 – Computational Biomechanics MATLAB: Getting Started Prof. Anthony J. Petrella Computational Biomechanics Group.
A Brief Introduction to Matlab Laila Guessous Dept. of Mechanical Engineering Oakland University.
COMP 116: Introduction to Scientific Programming Lecture 28: Midterm #2 Review.
MATLAB Tutorial EE 327 Signals and Systems 1. What is MATLAB? MATLAB – Matrix Laboratory The premier number-crunching software Extremely useful for signal.
Introduction to MATLAB Session 3 Simopekka Vänskä, THL Department of Mathematics and Statistics University of Helsinki 2011.
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.
Introduction to MATLAB Session 1 Simopekka Vänskä, THL 2010.
OUTLINE Overview Numbers, variables and similar in Matlab
Introduction to Matlab. Outline:  What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display.
Introduction to Matlab By E. Noura Semary. Contents MATLAB Environment  Command window, Workspace, Path window, Editor window,and Figure window) Basic.
Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz SUNY-New Paltz “Lecture 2”
Introduction to Matlab Part II 1Daniel Baur / Introduction to Matlab Part II Daniel Baur / Michael Sokolov ETH Zurich, Institut für Chemie- und Bioingenieurwissenschaften.
A Quick Octave Tutorial 阮 翀
Introduction to Matlab
Matlab Basic. MATLAB Product Family 2 3 Entering & Quitting MATLAB To enter MATLAB double click on the MATLAB icon. To Leave MATLAB Simply type quit.
Introduction to Matlab Electromagnetic Theory LAB by Engr. Mian Shahzad Iqbal.
INTRODUCTION TO MATLAB DAVID COOPER SUMMER Course Layout SundayMondayTuesdayWednesdayThursdayFridaySaturday 67 Intro 89 Scripts 1011 Work
INTRODUCTION TO MATLAB Dr. Hugh Blanton ENTC 4347.
Introduction to MATLAB 1.Basic functions 2.Vectors, matrices, and arithmetic 3.Flow Constructs (Loops, If, etc) 4.Create M-files 5.Plotting.
General Computer Science for Engineers CISC 106 Lecture 13 - Midterm Review James Atlas Computer and Information Sciences 10/02/2009.
Introduction to Matlab Patrice Koehl Department of Biological Sciences National University of Singapore
The MatLab Language Mathematics Laboratory The MathWorks
CSE 455 : Computer Vision MATLAB 101 Getting Started with MATLAB.
Intro to Matlab Rogelio Long September 3, How to access MyDesktop Log in with your utep id and password.
Introduction to Programming on MATLAB Ecological Modeling Course Sep 11th, 2006.
Introduction to Matlab Engr. Mian Shahzad Iqbal LAB NO.2
Machine Learning Octave tutorial 데이터 마이닝 박 영 택.
Matlab & Image processing toolbox Heejune Ahn SeoulTech Last updated Jan.
NoViC, Dept. of Mechanical Eng Acoustics Lab., NoViC 1. Download Matlab 2.
Outline What is MATLAB MATLAB desktop Variables, Vectors and Matrices Matrix operations Array operations Built-in functions: Scalar, Vector, Matrix Data.
Introduction to Matlab PHY September Why Matlab? No need to compile code Huge amount of built-in functions Highly optimized and fast, in general.
MATLAB DENC 2533 ECADD LAB 9.
Introduction to Matlab
Matlab Workshop 9/22/2018.
StatLab Matlab Workshop
MATLAB Tutorial Dr. David W. Graham.
StatLab Workshop: Intro to Matlab for Data Analysis and Statistical Modeling 11/29/2018.
Matlab tutorial course
CS 175 Project in AI Discussion -- 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.
How to Use MATLAB A Brief Introduction.
Presentation transcript:

Intro to Matlab Yipei Wang & Qihui Li {yipeiw,

Installation matlab/ Interpreted Language – Interactive/script – Avoid loop if possible – Find built-in function for matrix manipulation first before implementing by yourself

Basics Workspace (command, whos) “;” clear variable Index starts from 1 help function_name

Matrix Create matrices A=[1,2,3; 4,5,6] A=1:2:10 %start at 1, increment by 2, stop at 10 A=zeros(2,3), A=ones(2,3) Check out the functions: randn, eye, diag

Matrix Indexing (starts from 1) A=[1,2,3; 4,5,6]; A(1,2) %row 1, column2 A(end, 2) %last row, column2 A(1:2, 2:3) % elements in row 1-2, column 2-3 A(:, 1:2) %elements in all rows, column 1-2 Logical indexing B=A>2

Matrix Operations on matrix – Transpose, A’ – inverse inv(A) – sum, mean, max, min – concatenating A=[[1,2]; ones(1,2)] Element-wise arithmetic 3.*A, A./3 A.^2 A./B, A.*B Check these functions: repmat, det, trace, svd, rank, sparse

Variables & Data Structure Matrix, vector String – Check these functions: str2num, strcat, strcmp Cell (support holding elements of different types) – Ex. A={[1,2], ‘hello’; ‘yes’, {3}}

Flow of Control If, else, elseif For loop

Function Define In the file myfunction.m function [output1,output2, output3] = myfunction(input1, input2) … Call the function [a1, a2, a3] = myfunction(param1, param2); Note: – File name must be the same with the function name – Filepath, you can only call the function which the file put in the same directory

Plotting Example (plot_example.m) Check these functions: plot, scatter, subplot axis

Useful Tricks Speed up – Timing the code call tic before your code starts andtoc afterwords – Vectorization Use vectorized built-in functions Ex. log(A) Logical indexing Ex. B = A(A<0.2)

Complex example (e1.m) Non-vectroization Vectorization

Others Debugging – Set breakpoint and check variables in workspace – _prog/debugging-process-and-features.html _prog/debugging-process-and-features.html Reference

Questions?