Mikael Johansson and Frank Lingelbach Department of Signals, Sensors and Systems Based on lectures by F. Gustafsson,

Slides:



Advertisements
Similar presentations
Mikael Johansson and Frank Lingelbach Department of Signals, Sensors and Systems Based on lectures by F. Gustafsson,
Advertisements

MATLAB – What is it? Computing environment / programming language Tool for manipulating matrices Many applications, you just need to get some numbers in.
About Me Tutor Name: Steven Halim Full-time Teaching Assistant and part-time PhD (final year?) in SoC, NUS Former Teaching Assistant for IT1005, Sem 2,
Chapter 1 Computing Tools Data Representation, Accuracy and Precision Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction.
Introduction to MATLAB Northeastern University: College of Computer and Information Science Co-op Preparation University (CPU) 10/22/2003.
Advanced MATLAB (for Electrical Engineers) Instructor: Kamran Arshad EE Club, KFUPM 28 March 2004 KFUPM.
Matlab Intro. Outline Matlab introduction Matlab elements Types Variables Matrices.
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.
MATLAB Lecture One Monday 4 July Matlab Melvyn Sim Department of Decision Sciences NUS Business School
Matlab tutorial course Lesson 2: Arrays and data types
MATLAB INTRO CONTROL LAB1  The Environment  The command prompt Getting Help : e.g help sin, lookfor cos Variables Vectors, Matrices, and Linear Algebra.
What is Matlab? A software environment for interactive numerical computations Examples: –Matrix computations and linear algebra –Solving nonlinear equations.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
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 Session 1 Prepared By: Dina El Kholy Ahmed Dalal Statistics Course – Biomedical Department -year 3.
You can make this in matlab!. Matlab Introduction and Matrices.
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.
INTRODUCTION FOR PERL MONGERS MATLAB. Outline 1. Matlab, what is it good for 2. Matlab’s IDE & functions 3. A few words about Maple 4. What needs to be.
CSE123 Lecture 5 Arrays and Array Operations. Definitions Scalars: Variables that represent single numbers. Note that complex numbers are also scalars,
1 Lab of COMP 406 Teaching Assistant: Pei-Yuan Zhou Contact: Lab 1: 12 Sep., 2014 Introduction of Matlab (I)
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
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.
CMPS 1371 Introduction to Computing for Engineers MATRICES.
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 Session 1 Simopekka Vänskä, THL 2010.
OUTLINE Overview Numbers, variables and similar in Matlab
Working with Arrays in MATLAB
Introduction to Matlab. What is Matlab? A software environment for interactive numerical computations Examples:  Matrix computations and linear algebra.
INTRODUCTION TO MATLAB MATLAB is a software package for computation in engineering, science, and applied mathemat-ics. It offers a powerful programming.
Introduction to GAMS, Netlib, Numerical Recipes CS 3414.
BOĞAZİÇİ UNIVERSITY DEPARTMENT OF MANAGEMENT INFORMATION SYSTEMS MATLAB AS A DATA MINING ENVIRONMENT.
EGR 115 Introduction to Computing for Engineers Introduction to Computer Programming Wednesday 27 Aug 2014 EGR 115 Introduction to Computing for Engineers.
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
CIS 601 Fall 2003 Introduction to MATLAB Longin Jan Latecki Based on the lectures of Rolf Lakaemper and David Young.
M ATLAB – What Is It ? Name is from matrix laboratory Powerful tool for – Computation and visualization of engineering and science mathematics – Communication.
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.
“Moh’d Sami” AshhabSummer 2008University of Jordan MATLAB By (Mohammed Sami) Ashhab University of Jordan Summer 2008.
An Introduction to Programming in Matlab Emily Blumenthal
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
Chapter 1 Computing Tools Variables, Scalars, and Arrays Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Introduction to Matlab
Introduction to MATLAB
Computer Application in Engineering Design
Welcome to MATLAB.
Introduction to Matlab ( Google Search )
INTRODUCTION TO BASIC MATLAB
MATLAB DENC 2533 ECADD LAB 9.
(Mohammed Sami) Ashhab
Matlab Workshop 9/22/2018.
Introduction to MATLAB
Part I – Matlab Basics.
StatLab Workshop: Intro to Matlab for Data Analysis and Statistical Modeling 11/29/2018.
Lecture 2 Introduction to MATLAB
Matlab Fundamentals.
Digital Image Processing
Communication and Coding Theory Lab(CS491)
Introduction to MATLAB
DT001A, Simulation of communication systems, 7.5 ECTS
Simulation And Modeling
Working with Arrays in MATLAB
Introduction To MATLAB
Presentation transcript:

Mikael Johansson and Frank Lingelbach Department of Signals, Sensors and Systems Based on lectures by F. Gustafsson, Linköping University Introduction to Matlab 2E1215, Lecture 1 – Matlab Basics

2 Introduction to Matlab What is Matlab? A software environment for interactive numerical computations Examples:  Matrix computations and linear algebra  Solving nonlinear equations  Numerical solution of differential equations  Mathematical optimization  Statistics and data analysis  Signal processing  Modelling of dynamical systems  Solving partial differential equations  Simulation of engineering systems

3 Introduction to Matlab What will you learn ? Effective Matlab usage  Possibilities and limitations  Syntax and interactive computations  Matlab programming (using functions and script files)  Visualization  Optimization of code for efficient computations

4 Introduction to Matlab Why should you attend This Course ? Matlab used (on a daily basis) in many engineering companies

5 Introduction to Matlab Why should you attend 2E1215? Matlab used in many courses at KTH 2D1240 Numerical analysis 5B1209 Signal and Systems I 2E1313 Signals and Systems II 2E1280 Modeling of Dynamical Systems 2E1200 Automatic Control, Basic Course 2E1252 Automatic Control, Advanced Course 2E1262 Nonlinear Control 2E1245Hybrid and Embedded Control Systems 2E1291 Chemical Process Control 2E1241 Control Project Course 2E1421 Signal Theory 2E1340 Digital Signal Processing 2E1350 Adaptive Signal Processing 2E1366 Signal Processing Project 2E1431 Communication theory 2E1435 Advanced Communication Theory

6 Introduction to Matlab Today’s Lecture Course information  Course contents and literature  Course guide Matlab Basics  Background to Matlab  Interactive calculations  Vectors and matrices  Graphical illustrations Next lecture: Matlab programming

7 Introduction to Matlab Part I – Course Information

8 Introduction to Matlab 2E1215 – Introduction to Matlab Student Handbook: One credit (1.5 ECTS) self study course. Eligible. Objectives:  Gain basic knowledge of Matlab programming  To prepare for other courses where Matlab is used  To give insight into a state-of-the-art tool for technical computation and visualization

9 Introduction to Matlab Prerequisites  Basic knowledge from calculus & linear algebra  Basic programming skills (helpful, not necessary!)  Internet and computer experience  Curiosity!

10 Introduction to Matlab Course Literature N. Bergman and F. Gustafsson, ”Matlab for Engineers Explained”, Springer, 2003 Available via student book store (”kårbokhandeln”)  Teaches practical Matlab usage (not a full manual)  Basic description of theoretical concepts  Based on examples with guided tours of the system  Exercises with solutions  Applications from engineering courses Suggested exercises: 1-5, 8-17, 21, 23-32, 34, 37, 40-41, 44, 47-48

11 Introduction to Matlab Course Guide Schedule Information Registration Examination

12 Introduction to Matlab Computer Exercises You will need account at Our Server Site 1.Register for course (necessary!) 2.Fill in (all the fields of) the list that is circulating 3.You will be then be able to use the computers on Monday afternoon.

13 Introduction to Matlab Course Guide - Marks within 24h Internet ServerParticipant A Participant B Solutions during the last 24 hours Passed participants 00: :56 LADOK Report

14 Introduction to Matlab Part II – Matlab Basics

15 Introduction to Matlab Matlab Background 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) AlternativesComplements Matrix-XMaple(symbolic) Octave(free; GNU)Mathematica(symbolic) Lyme(free; Palm)

16 Introduction to Matlab Construction 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 m-files C-kernel Sig. Proc Simulink Contr. Syst.

17 Introduction to Matlab 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 e-016 !?

18 Introduction to Matlab IEEE Standard for double precision numbers Round-off: eps = Underflow: realmin = Overflow: realmax = (2- eps ) · Floating point numbers in Matlab sef

19 Introduction to Matlab 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

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

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

22 Introduction to Matlab 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.’

23 Introduction to Matlab 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)]

24 Introduction to Matlab 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

25 Introduction to Matlab 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, ”. ” is elementwise operation

26 Introduction to Matlab 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)

27 Introduction to Matlab 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)

28 Introduction to Matlab 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

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

30 Introduction to Matlab Next Lecture Programming in MATLAB