Part I – Matlab Basics.

Slides:



Advertisements
Similar presentations
Introduction to MATLAB The language of Technical Computing.
Advertisements

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.
Advanced MATLAB (for Electrical Engineers) Instructor: Kamran Arshad EE Club, KFUPM 28 March 2004 KFUPM.
Introduction to Array The fundamental unit of data in any MATLAB program is the array. 1. An array is a collection of data values organized into rows and.
Digital Image Processing Lecture3: Introduction to MATLAB.
259 Lecture 15 Introduction to MATLAB. 2 What is MATLAB?  MATLAB, which stands for “MATrix LABoratory” is a high- performance language for technical.
© 2004 The MathWorks, Inc. 1 MATLAB for C/C++ Programmers Support your C/C++ development using MATLAB’s prebuilt graphics functions and trusted numerics.
MATLAB Lecture One Monday 4 July Matlab Melvyn Sim Department of Decision Sciences NUS Business School
What is Matlab? A software environment for interactive numerical computations Examples: –Matrix computations and linear algebra –Solving nonlinear equations.
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.
Mikael Johansson and Frank Lingelbach Department of Signals, Sensors and Systems Based on lectures by F. Gustafsson,
Introduction to MATLAB adapted from Dr. Rolf Lakaemper.
Introduction to MATLAB Session 1 Prepared By: Dina El Kholy Ahmed Dalal Statistics Course – Biomedical Department -year 3.
MATLAB Tutorials Session I Introduction to MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU.
Introduction to Matlab 1. Outline: What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators Plotting Flow Control Using of M-File Writing.
1 Lab of COMP 406 Teaching Assistant: Pei-Yuan Zhou Contact: Lab 1: 12 Sep., 2014 Introduction of Matlab (I)
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
Eng Ship Structures 1 Introduction to Matlab.
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (1): Introduction.
Matlab Programming for Engineers Dr. Bashir NOURI Introduction to Matlab Matlab Basics Branching Statements Loops User Defined Functions Additional Data.
MATLAB Harri Saarnisaari, Part of Simulations and Tools for Telecommunication Course.
Basics of MATLAB By DR. Wafaa Shabana
Matlab 14.html Cost: $100 Available in labs on Windows and Unix machines.
Introduction to MATLAB adapted from Dr. Rolf Lakaemper.
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. What is Matlab? A software environment for interactive numerical computations Examples:  Matrix computations and linear algebra.
Mikael Johansson and Frank Lingelbach Department of Signals, Sensors and Systems Based on lectures by F. Gustafsson,
CIS 601 Fall 2003 Introduction to MATLAB Longin Jan Latecki Based on the lectures of Rolf Lakaemper and David Young.
Introduction to Matlab Patrice Koehl Department of Biological Sciences National University of Singapore
MATLAB Lecture 1 염익준. Introduction MATLAB (MATrix LABoratory) a special purpose computer program optimized to perform engineering and scientific calculations.
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 2 : Matlab - Getting Started.
CIS 595 MATLAB First Impressions. MATLAB This introduction will give Some basic ideas Main advantages and drawbacks compared to other languages.
An Introduction to Programming in Matlab Emily Blumenthal
Beginning Programming for Engineers Animation. Special matrix functions >> clear >> ones(2,3) >> zeros(3,5) >> ones(2) >> zeros(3) >> eye(4) >> magic(4)
MATLAB ……………….matrix laboratory. Bhushan D Patil PhD Research Scholar Department of Electrical Engineering Indian Institute of Technology, Bombay Powai,
Matlab Programming for Engineers
ECE 1304 Introduction to Electrical and Computer Engineering
Matlab.
Introduction to MATLAB
Introduction to Matlab
Software for scientific calculations
Statistical Computing in MATLAB
MATLAB Basics Nafees Ahmed Asstt. Professor, EE Deptt DIT, DehraDun.
Welcome to MATLAB.
Introduction to Matlab ( Google Search )
Outline Matlab tutorial How to start and exit Matlab Matlab basics.
INTRODUCTION TO BASIC MATLAB
MATLAB DENC 2533 ECADD LAB 9.
(Mohammed Sami) Ashhab
Matlab Workshop 9/22/2018.
Introduction To MATLAB
Introduction to MATLAB
StatLab Matlab Workshop
Digital Image Processing using MATLAB
Use of Mathematics using Technology (Maltlab)
StatLab Workshop: Intro to Matlab for Data Analysis and Statistical Modeling 11/29/2018.
Lecture 2 Introduction to MATLAB
Matlab Fundamentals.
Introduction to MATLAB [Vectors and Matrices] Lab 2
Digital Image Processing
Matlab Intro.
Simulation And Modeling
Introduction to Matlab
Working with Arrays in MATLAB
Introduction To MATLAB
Matlab Intro.
Presentation transcript:

Part I – Matlab Basics

Matlab Background Alternatives Complements Matlab = Matrix Laboratory Originally a user interface for numerical linear algebra routines (Lapak/Linpak) Commercialized 1984 by The Mathworks Since then heavily extended (defacto-standard) Alternatives Complements Matrix-X Maple (symbolic) Octave (free; GNU) Mathematica (symbolic) SAS IML

Construction Statistics Sig. Proc Simulink m-files C-kernel Core functionality: compiled C-routines Most functionality is given as m-files, grouped into toolboxes m-files contain source code, can be copied and altered m-files are platform independent (PC, Unix/Linux, MAC) Simulation of dynamical systems is performed in Simulink Statistics Sig. Proc Simulink m-files C-kernel

What is Matlab? MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to-use environment. Math and computation Algorithm development Data acquisition Modeling, simulation, and prototyping Data analysis, exploration, and visualization Scientific and engineering graphics Application development, including graphical user interface building

Interactive Calculations Matlab is interactive, no need to declare variables >> 2+3*4/2 >> a=5e-3; b=1; a+b Most elementary functions and constants are already defined >> cos(pi) >> abs(1+i) >> sin(pi) Last call gives answer 1.2246e-016 !?

Variable and Memory Management Matlab uses double precision (approx. 16 significant digits) >> format long >> format compact All variables are shown with >> who >> whos Variables can be stored on file >> save filename >> clear >> load filename

The Help System Search for appropriate function >> lookfor keyword Rapid help with syntax and function definition >> help function Or >> help An advanced hyperlinked help system is launched by >> helpdesk Complete manuals as PDF files

Vectors and Matrices Vectors (arrays) are defined as >> w = [1; 2; 4; 5] Matrices (2D arrays) defined similarly >> A = [1,2,3;4,-5,6;5,-6,7]

Matrix Operators All common operators are overloaded >> v + 2 Common operators are available >> B = A’ >> A*B >> A+B Note: Matlab is case-sensitive A and a are two different variables Transponate conjugates complex entries; avoided by >> B=A.’

Indexing Matrices Indexing using parentheses >> A(2,3) Index submatrices using vectors of row and column indices >> A([2 3],[1 2]) Ordering of indices is important! >> B=A([3 2],[2 1]) >> B=[A(3,2),A(3,1);A(2,2),A(2,1)]

Indexing Matrices Index complete row or column using the colon operator >> A(1,:) Can also add limit index range >> A(1:2,:) >> A([1 2],:) General notation for colon operator >> v=1:5 >> w=1:2:5

Matrix Functions Many elementary matrices predefined >> help elmat; >> I=eye(3) Elementary functions are often overloaded >> help elmat >> sin(A) Specialized matrix functions and operators >> As=sqrtm(A) >> As^2 >> A.*A Note: in general, ”.<operator>” is elementwise operation

Numerical Linear Algebra Basic numerical linear algebra >> z=[1;2;3]; x=inv(A)*z >> x=A\z Many standard functions predefined >> det(A) >> rank(A) >> eig(A) The number of input/output arguments can often be varied >> [V,D]=eig(A)

Graphics Visualization of vector data is available >> x=-pi:0.1:pi; y=sin(x); >> plot(x,y) >> plot(x,y,’s-’) >> xlabel(’x’); ylabel(’y=sin(x)’); Can change plot properties in Figure menu, or via ”handle” >> h=plot(x,y); set(h, ’LineWidth’, 4); Many other plot functions available >> v=1:4; pie(v)

Graphics Three-dimensional graphics >> A = zeros(32); >> A(14:16,14:16) = ones(3); >> F=abs(fft2(A)); >> mesh(F) >> rotate3d on Several other plot functions available >> surfl(F) Can change lightning and material properties >> cameramenu >> material metal

Graphics Bitmap images can also be visualized >> load mandrill >> image(X); colormap(map) >> axis image off

An Example: Construct a random symmetrical U-type design

An Example: Construct a random symmetrical U-type design function x=randdesign(n,m,arg1) % x=randdesign(n,m,s) generate a random design with n % runs, m s-level factors % x=randdesign(n,m) generate a random design with n % runs, m n-level factors % by Ma Changxing 1999.5.9 if nargin<3, s=n; else s=arg1; end [y x]=sort(rand(n,m)); x=mod(x,s)+1;