Josh Xiaomin Xi PhD Candidate Feb 27, 2013 A tutorial from.

Slides:



Advertisements
Similar presentations
MATLAB – A Computational Methods By Rohit Khokher Department of Computer Science, Sharda University, Greater Noida, India MATLAB – A Computational Methods.
Advertisements

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.
Matlab Programming Huajun Wang Department of Earth Sciences, Zhejiang University Jan 25,2012.
Matlab Graphics S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Introduction to Matlab: 2D Graphics.
MATLAB – What is it? Computing environment / programming language Tool for manipulating matrices Many applications, you just need to get some numbers in.
Introduction to Matlab EE 2303 Lab. MATLAB stands for “Matrix Laboratory” APPLICATIONS OF MATLAB:  Mathematical Calculations  Data Analysis & Visualization.
Introduction to Matlab. I use Matlab for: Data analysis Data plotting Image Analysis Also – Simulations (solving odes/pdes/finite element methods) – Minimisations,
Introduction to MATLAB Week 13 – 4/21/09. Instructor: Kate Musgrave Time: Tuesdays 3-5pm Office Hours: Tuesdays 1:30-3pm
Exam #3 Review: Comprehensive Exam Class 14.2 Palm Matlab Book Ch. 1-5.
An Introduction to Optimization Theory. Outline Introduction Unconstrained optimization problem Constrained optimization problem.
Introduction to MATLAB
Matlab intro The Environment
259 Lecture 15 Introduction to MATLAB. 2 What is MATLAB?  MATLAB, which stands for “MATrix LABoratory” is a high- performance language for technical.
MATLAB Lecture One Monday 4 July Matlab Melvyn Sim Department of Decision Sciences NUS Business School
MATLAB INTRO CONTROL LAB1  The Environment  The command prompt Getting Help : e.g help sin, lookfor cos Variables Vectors, Matrices, and Linear Algebra.
1 Statistical Computing in MATLAB AMS 597 Ling Leng.
Nonparametric Econometrics1 Intro to Matlab for Data Analysis and Statistical Modeling.
Introduction to MATLAB Session 1 Prepared By: Dina El Kholy Ahmed Dalal Statistics Course – Biomedical Department -year 3.
Introduction to MATLAB January 18, 2008 Steve Gu Reference: Eta Kappa Nu, UCLA Iota Gamma Chapter, Introduction to MATLAB,
MATLAB Tutorials Session I Introduction to MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU.
Introduction to MATLAB
ELG 3120 Signal and System Analysis 1 Introduction to MATLAB TAs Wei Zhang Ozgur Ekici (Section A)(Section B) ELG 3120 Lab Tutorial 1.
How to Use MATLAB A Brief Introduction. 2 What can MATLAB do? Matrix Operations Symbolic Computations Simulations Programming 2D/3D Visualization.
Introduction to MATLAB CBE 502 Mathematical Methods of Engineering Analysis.
Fin500J: Mathematical Foundations in Finance
Introduction to MATLAB ENGR 1181 MATLAB 1. Programming In The Real World Programming is a powerful tool for solving problems in every day industry settings.
A Brief Introduction to Matlab Laila Guessous Dept. of Mechanical Engineering Oakland University.
EECE 360/460 Matlab Tutorial Jan Outline What is Matlab? What is Matlab? Matlab Interface Matlab Interface Basic Syntax Basic Syntax Plotting Graphs.
The Language of Math Punctuation. Punctuation is used in English and other languages to give meaning to what is written. Periods and question marks end.
INTRODUCTION TO MATLAB LAB# 01
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (1): Introduction.
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.
Lecture 1 - Introduction June 3, 2002 CVEN 302. Lecture’s Goals General Introduction to CVEN Computer Applications in Engineering and Construction.
Chapter 1: Getting Started with MATLAB MATLAB for Scientist and Engineers Using Symbolic Toolbox.
What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad.
Intro to Matlab 1.Using scalar variables 2.Vectors, matrices, and arithmetic 3.Plotting 4.Solving Systems of Equations Can be found at:
CMPS 1371 Introduction to Computing for Engineers MatLab.
Basics of MATLAB By DR. Wafaa Shabana
Introduction to MATLAB Session 1 Simopekka Vänskä, THL 2010.
ME6104: CAD. Module 4. ME6104: CAD. Module 4. Systems Realization Laboratory Module 4 Matlab ME 6104 – Fundamentals of Computer-Aided Design.
OUTLINE Overview Numbers, variables and similar in Matlab
1 Lecture 1 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
Introduction to MATLAB Zongqiang Liao Research Computing Group UNC-Chapel Hill.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Chapter 15 General Least Squares and Non- Linear.
Introduction to Matlab Electromagnetic Theory LAB by Engr. Mian Shahzad Iqbal.
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.
Introduction to Matlab Patrice Koehl Department of Biological Sciences National University of Singapore
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 2 : Matlab - Getting Started.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
Introduction to Programming on MATLAB Ecological Modeling Course Sep 11th, 2006.
Matlab Tutorial Iman Moazzen First Session – September 11, 2013.
“Moh’d Sami” AshhabSummer 2008University of Jordan MATLAB By (Mohammed Sami) Ashhab University of Jordan Summer 2008.
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
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
Introduction to MATLAB
INTRODUCTION TO BASIC MATLAB
MATLAB DENC 2533 ECADD LAB 9.
Introduction to Matlab
(Mohammed Sami) Ashhab
Introduction To MATLAB
EEE 244 Numerical Methods In Electrical Engineering
Experiment No. (1) - an introduction to MATLAB
How to Use MATLAB A Brief Introduction.
Matlab Basics Tutorial
Presentation transcript:

Josh Xiaomin Xi PhD Candidate Feb 27, 2013 A tutorial from

INFORMS OSUJosh Xiaomin XiA Matlab Tutorial2 / INF Overview  Introduction  Installation (Toolboxes)  Layout of Matlab Windows  Basics of Matlab language  Arithmetic Operations  Variables  Matrix  Plot  Functions: inline and sym  Programming in Matlab  m-file  Optimization in Matlab

INFORMS OSUJosh Xiaomin XiA Matlab Tutorial3 / INF Intro  MATLAB: MATrix and LABoratory  First developed by Dr. Cleve Molder: Fortran based  In 1984, MathWorks was founded: C based

INFORMS OSUJosh Xiaomin XiA Matlab Tutorial4 / INF Intro: Installation  Go to:

INFORMS OSUJosh Xiaomin XiA Matlab Tutorial5 / INF Intro: Installation  Select the tool boxes that you need  e.g. Matlab, curve fitting, optimization, statistics, symbolic math, etc.

INFORMS OSUJosh Xiaomin XiA Matlab Tutorial6 / INF Intro: Matlab Windows Layout  Command Window  Command History  Current Directory Browser  Workspace Browser

INFORMS OSUJosh Xiaomin XiA Matlab Tutorial7 / INF Overview  Introduction  Installation (Toolboxes)  Layout of Matlab Windows  Basics of Matlab language  Arithmetic Operation  Variables  Matrix  Plot  Functions: inline and sym  Programming in Matlab  m-file

INFORMS OSUJosh Xiaomin XiA Matlab Tutorial8 / INF Basics: Arithmetic Operations + plus - minus * multiply / right divide \ left divide ^ exponential 2+3=5 2-3= -1 2*3=6 2/3= \3= ^3=8

INFORMS OSUJosh Xiaomin XiA Matlab Tutorial9 / INF Basics: Variables  How to define a variable name  Numbers and letter, but first component must be a letter  Case sensitive  No space, punctuations (except underline)  Special variables  ans  NaN, nan  Inf, -Inf  pi  i, j  realmax, realmin  However, you can redefine these variables, and use “clear” to clear redefinition.

INFORMS OSUJosh Xiaomin XiA Matlab Tutorial10 / INF Basics: Matrix  How to define a matrix/vector  A = [ ; ] ~~ [1:4; 4:7] (!!! Comma, colon, semicolon bracket)  Special matrix  zeros(m,n)  ones(m,n)  diag(vec)  Matrix operation  Basic arithmetic operation (!!! Period & dimensions)  Inverse (inv) and transpose (apostrophe)  Read/change matrix component (!!! parenthesis)  Stacking and breaking  Size(), length(), eig()

INFORMS OSUJosh Xiaomin XiA Matlab Tutorial11 / INF Basics: Plot  An example of attenuation oscillation curve: t=0:pi/50:4*pi; y=exp(-t/3).*sin(3*t); plot(t,y,'-r') grid  Use “help” to find more info of plot, e.g. linespec, legend, title, xlabel loglog log plot, taking log on both x & y semilogx log plot, taking log only on x semilogy log plot, taking log only on y mesh 3-d plot bar bar chart Subplot one figure with sub figures  Other

INFORMS OSUJosh Xiaomin XiA Matlab Tutorial12 / INF Basics: Functions  Use “sym” / “syms”  Use “inline” syms x y; f=3*sin(2*x^2-y) Df=diff(f) Df2=diff(f,2) subs(f,x,4) fin=inline(char(f)) fin(1,1) f=inline(‘3*sin(2*x^2-y)’) f=inline(‘3*sin(2*x^2-y)’,’x’,’y’) f(1,1)

INFORMS OSUJosh Xiaomin XiA Matlab Tutorial13 / INF Overview  Introduction  Installation (Toolboxes)  Layout of Matlab Windows  Basics of Matlab language  Arithmetic Operation  Variables  Matrix  Plot  Functions  Programming in Matlab  m-file: run large program, build large function  Control flow: if-else, while, for

INFORMS OSUJosh Xiaomin XiA Matlab Tutorial14 / INF M File  Replace command window when running large code  Easy management  Can be reused in future  Define functions / sub-sections  Better structure  Good for complicated programming/logic

INFORMS OSUJosh Xiaomin XiA Matlab Tutorial15 / INF Control Flow  If-Else If condition expression(s) 1; else expression(s) 2; end If condition1 expression(s) 1; else if condition2 expression(s) 2; else expression(s) 3; end If t >= 2 F = 40; else if t > 1 F = 30; else if t > 0 F = 20; else F = 10; end

INFORMS OSUJosh Xiaomin XiA Matlab Tutorial16 / INF Control Flow  For / while for i=1:5; for j=1:3 x(i, j)= i * j; end x = n=1; while prod ( 1 : n ) < 100; n=n+1; end n Result: n = 5 。 Because 5x4x3x2x1=120

INFORMS OSUJosh Xiaomin XiA Matlab Tutorial17 / INF Optimization In Matlab  Common optimization functions  linprog: linear programming  Quadprog: quadratic programming  fmincon: constrained non-linear minimization  fminsearch, fminunc: unconstrained nonlinear minimization  fsolve: non-linear system of equations solve  lsqlin: linear least square with linear constraints

INFORMS OSUJosh Xiaomin XiA Matlab Tutorial18 / INF Optimization: linprog  linprog: linear programming Min f(x) = –5x1 –4x2 –6x3 s.t. x1 – x2 + x3 ≤ 20 3x1 + 2x2 + 4x3 ≤ 42 3x1 + 2x2 ≤ 30 0 ≤ x1, 0 ≤ x2, 0 ≤ x3.