CSci 2031: Matlab Tutorial Guoquan (Paul) Huang Jan 24, 2008.

Slides:



Advertisements
Similar presentations
Matlab Intro Simple introduction to some basic Matlab syntax. Declaration of a variable [ ] Matrices or vectors Some special (useful) syntax. Control statements.
Advertisements

StatLab Workshop Yale University Maximiliano Appendino, Economics October 18 th, 2013.
Introduction to Matlab
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.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 19P. 1Winter Quarter MATLAB: Script and.
ECEN/MAE 3723 – Systems I MATLAB Lecture 1. Lecture Overview  Introduction and History  Matlab architecture  Operation basics  Visualization  Programming.
Introduction to MATLAB and image processing. MATLAB and images The help in MATLAB is very good, use it! An image in MATLAB is treated as a matrix Every.
MATLAB for Image Processing April 10 th, Outline Introduction to MATLAB –Basics & Examples Image Processing with MATLAB –Basics & Examples.
Lecture 5 Review Programming Program Structures Comparison Repetition: looping or iteration Conditional execution: branching Bubble Sort.
MATLAB ME1107 Y Yan Reference: MATLAB for Engineers by Holly Moore (Pearson Prentice Hall)
Introduction to Matlab By: Dr. Maher O. EL-Ghossain.
Exam #3 Review: Comprehensive Exam Class 14.2 Palm Matlab Book Ch. 1-5.
Programming in MATLAB Week 14 – 4/28/09 Kate Musgrave
C ENTER FOR I NTEGRATED R ESEARCH C OMPUTING MATLAB
MATLAB FOR PATTERN RECOGNITION By: Özge Öztimur. How Much Do We Know? Anybody who has never used MATLAB?
MATLAB and SimulinkLecture 11 To days Outline  Introduction  MATLAB Desktop  Basic Features  Branching Statements  Loops  Script file / Commando.
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 January 18, 2008 Steve Gu Reference: Eta Kappa Nu, UCLA Iota Gamma Chapter, Introduction to MATLAB,
Introduction to Matlab 1. Outline: What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators Plotting Flow Control Using of M-File Writing.
Lecture 4 MATLAB Windows Arithmetic Operators Maintenance Functions
REVIEW 2 Exam History of Computers 1. CPU stands for _______________________. a. Counter productive units b. Central processing unit c. Copper.
Introduction to MATLAB. Windows in MATLAB Command Window – where you enter data, run MATLAB code, and display results Command History - displays a log.
How to think through your program [ principles of good program design ] Rachel Denison MATLAB for Cognitive Neuroscience ICN, 13 December 2007.
Matlab Programming, part 1 M-files It is generally more convenient to program in Matlab using m-files, ascii text files containing a set of Matlab commands.
Introduction to Engineering MATLAB – 1 Introduction to MATLAB Agenda Introduction Arithmetic Operations MATLAB Windows Command Window Defining Variables.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
INTRODUCTION TO MATLAB LAB# 01
Gulsah Tumuklu Ozyer MATLAB IMAGE PROCESSING TOOLBOX.
Matlab Basics Tutorial. Vectors Let's start off by creating something simple, like a vector. Enter each element of the vector (separated by a space) between.
Advanced Topics- Functions Introduction to MATLAB 7 Engineering 161.
Introduction to MATLAB
Introduction MATLAB stands for MATrix LABoratory.  Basics  Matrix Manipulations  MATLAB Programming  Graphics  Image types  Image Processing  Useful.
ME6104: CAD. Module 4. ME6104: CAD. Module 4. Systems Realization Laboratory Module 4 Matlab ME 6104 – Fundamentals of Computer-Aided Design.
Introduction to Matlab. Outline:  What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display.
Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz SUNY-New Paltz “Lecture 2”
MATLAB Programming COMM2M Harry R. Erwin, PhD University of Sunderland.
Introduction to Matlab
1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 10.
Introduction to Matlab Electromagnetic Theory LAB by Engr. Mian Shahzad Iqbal.
Introduction to MATLAB Section2, statistics course Third year biomedical dept. Dina El Kholy, Ahmed Dalal.
Outline Introduction to MATLAB Image Processing with MATLAB
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.
CS 170 – INTRO TO SCIENTIFIC AND ENGINEERING PROGRAMMING.
Introduction to Matlab Patrice Koehl Department of Biological Sciences National University of Singapore
Matlab Tutorial 1 David Goldstein University of Colorado Dept of Aerospace Engineering Sciences.
Introduction to Matlab Engr. Mian Shahzad Iqbal LAB NO.2
CS100A, Fall 1998, Lecture 201 CS100A, Fall 1998 Lecture 20, Tuesday Nov 10 More Matlab Concepts: plotting (cont.) 2-D arrays Control structures: while,
전자장 1 실험 - Matlab 사용법 - Photonic Systems Laboratory School of EE, Seoul National University Photonic Systems Lab School of EECS, S.N.U.
Matlab & Image processing toolbox Heejune Ahn SeoulTech Last updated Jan.
Basics of MATLAB 2- Programming in MATLAB By DR. Wafaa Shabana
Introduction to Matlab. Outline:  What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators.
Tutorial on Matlab Basics
Introduction to Matlab
L – Modeling and Simulating Social Systems with MATLAB
Scripts & Functions Scripts and functions are contained in .m-files
Expressions and Control Flow in JavaScript
Introduction to MATLAB
MATLAB DENC 2533 ECADD LAB 9.
Introduction to Matlab
Matlab Workshop 9/22/2018.
Introduction to MATLAB
L – Modelling and Simulating Social Systems with MATLAB
StatLab Matlab Workshop
StatLab Workshop: Intro to Matlab for Data Analysis and Statistical Modeling 11/29/2018.
Logical Operations In Matlab.
INTRODUCTION TO MATLAB
Presentation transcript:

CSci 2031: Matlab Tutorial Guoquan (Paul) Huang Jan 24, 2008

Matlab Basic How to get start For Windows: trivial… For Unix: %module load math/matlab/v %matlab Outside the campus, need SSH…

Matrix Matrix is a main data type in Matlab Matlab stands for Matrix Laboratory How to build a matrix A=[1 2 3; 4 5 6; 7 8 9] Special matrices zeros(n,m), ones(n,m), eye(n,m)

Basic Operations All the operators in Matlab defined on matrices: + - * / ^ sqrt sin cos Element wise operator with preceding dot:.*./.^ Comment: % Assignment: = num = 6 %assignment & display num = 6; %assignment

Logic Conditions ==,, ~=, ~ &, |, ~: element-by-element for matrices find( ‘ condition ’ ): return index of A ’ s elements that satisfy the condition

Flow Control Matlab has five flow control constructs (very similar with other languages): if statements for loops while loops switch statements break (or continue) statements

If If a == b …; elseif d==e …; else …; end

for for j = 1:n for k = 1:m … end

while while a>b … ; end

break vs. continue for i=1:n … ; break; End for i=1:n … ; continue; end

Basic Graphing (2D Plots) plot x = linspace(0,2*pi,200); f1 = sin(x); plot(x,f1) title('Plot of f_1 = sin(x)'); xlabel('x'); ylabel('f_1'); plot3, mesh, contour, …

Scripts and Functions There are two kinds of.m files Script: which do not accept input arguments or return output arguments. They operate on data in the workspace. Function: which can accept input arguments and return output arguments. Internal variables are local to the function.

Functions in Matlab Function: keyword as add new function Example: Suppose a file on disk called STAT.M: function [mean,stdev] = stat(x) %STAT Interesting statistics n = length(x); mean = sum(x) / n; stdev = sqrt(sum((x - mean).^2)/n);

Matlab Help In the Matlab help Click MATLAB Help, then search index for … On the web ATLAB_tutorial_master.html ATLAB_tutorial_master.html Check course website for more…

The End