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

Slides:



Advertisements
Similar presentations
Introduction to Matlab
Advertisements

Variations of the Turing Machine
AP STUDY SESSION 2.
1
1 Copyright © 2002 Pearson Education, Inc.. 2 Chapter 2 Getting Started.
Chapter 7 Constructors and Other Tools. Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 7-2 Learning Objectives Constructors Definitions.
Processes and Operating Systems
Myra Shields Training Manager Introduction to OvidSP.
Properties Use, share, or modify this drill on mathematic properties. There is too much material for a single class, so you’ll have to select for your.
Manuscript Central Training Author Center Module 2.
Introduction to Algorithms 6.046J/18.401J
We need a common denominator to add these fractions.
Introduction to Metview
Measurements and Their Uncertainty 3.1
Process a Customer Chapter 2. Process a Customer 2-2 Objectives Understand what defines a Customer Learn how to check for an existing Customer Learn how.
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
1 Advanced Tools for Account Searches and Portfolios Dawn Gamache Cindy Bylander.
1 Click here to End Presentation Software: Installation and Updates Internet Download CD release NACIS Updates.
1.
Solve Multi-step Equations
Order of Operations Lesson
Break Time Remaining 10:00.
Intel VTune Yukai Hong Department of Mathematics National Taiwan University July 24, 2008.
PP Test Review Sections 6-1 to 6-6
EIS Bridge Tool and Staging Tables September 1, 2009 Instructor: Way Poteat Slide: 1.
LIAL HORNSBY SCHNEIDER
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 24.1 Test-Driving the Ticket Information Application.
Operating Systems Operating Systems - Winter 2011 Dr. Melanie Rieback Design and Implementation.
Operating Systems Operating Systems - Winter 2012 Dr. Melanie Rieback Design and Implementation.
1 Multimedia Systems 2 Dr Paul Newbury School of Engineering and Information Technology ENGG II - 3A11 Ext:
Name Convolutional codes Tomashevich Victor. Name- 2 - Introduction Convolutional codes map information to code bits sequentially by convolving a sequence.
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
Factor P 16 8(8-5ab) 4(d² + 4) 3rs(2r – s) 15cd(1 + 2cd) 8(4a² + 3b²)
1..
Mobility Tool Fremtidens afrapportering 2013 – Erasmus Mobilitet / IP 2014 – Erasmus+ aktioner.
CMPT 275 Software Engineering
CONTROL VISION Set-up. Step 1 Step 2 Step 3 Step 5 Step 4.
© 2012 National Heart Foundation of Australia. Slide 2.
6.4 Best Approximation; Least Squares
Macromedia Dreamweaver MX 2004 – Design Professional Dreamweaver GETTING STARTED WITH.
Model and Relationships 6 M 1 M M M M M M M M M M M M M M M M
2004 EBSCO Publishing Presentation on EBSCOadmin.
Types of selection structures
20&27 May Agenda 1.Highlight the difference between system flow of e- Invoice and paper invoice – 15 minutes 2.Demonstrate the operation procedure.
WorkKeys Internet Version Training
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Chapter 12 Working with Forms Principles of Web Design, 4 th Edition.
12 January 2009SDS batch generation, distribution and web interface 1 ExESS IT tool for SDS batch generation, distribution and web interface ExESS IT tool.
Clock will move after 1 minute
PSSA Preparation.
Chapter 13 Web Page Design Studio
Physics for Scientists & Engineers, 3rd Edition
Tutorial 1: Sensitivity analysis of an analytical function
RefWorks: The Basics October 12, What is RefWorks? A personal bibliographic software manager –Manages citations –Creates bibliogaphies Accessible.
Introduction Peter Dolog dolog [at] cs [dot] aau [dot] dk Intelligent Web and Information Systems September 9, 2010.
1 DIGITAL INTERACTIVE MEDIA Wednesday, October 28, 2009.
South Dakota Library Network MetaLib User Interface South Dakota Library Network 1200 University, Unit 9672 Spearfish, SD © South Dakota.
1 Decidability continued…. 2 Theorem: For a recursively enumerable language it is undecidable to determine whether is finite Proof: We will reduce the.
State Variables.
Introduction to MATLAB Northeastern University: College of Computer and Information Science Co-op Preparation University (CPU) 10/22/2003.
MATLAB Lecture One Monday 4 July Matlab Melvyn Sim Department of Decision Sciences NUS Business School
Mikael Johansson and Frank Lingelbach Department of Signals, Sensors and Systems Based on lectures by F. Gustafsson,
MATLAB Tutorials Session I Introduction to MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU.
Mikael Johansson and Frank Lingelbach Department of Signals, Sensors and Systems Based on lectures by F. Gustafsson,
Introduction to Matlab ( Google Search )
Matlab Workshop 9/22/2018.
Part I – Matlab Basics.
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 Todays 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

3 Introduction to Matlab Part I – Course Information

4 Introduction to Matlab 2E1215 – Introduction to Matlab Student Handbook: One (1) credit 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

5 Introduction to Matlab Matlab at KTH 2D1240 Numeriska metoder 5B1209 Signaler och system I 2E1313 Signaler och system II 2E1315 Signaler och system II, D 2E1280 Modellering av dynamiska system 2E1200 Reglerteknik AK, F,M,T 2E1211 Reglerteknik AK, E 2E1252 Reglerteknik FK 2E1262 Olinjär reglering 2E1291 Kemiteknisk processreglering 2E1241 Projektkurs i reglerteknik 2E1421 Signalteori 2E1340 Digital signalbehandling 2E1350 Adaptiv signalbehanling 2E1366 Projektkurs i signalbehandling 2E1431 Kommunikationsteori 2E1435 Kommunikationsteori FK...

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

7 Introduction to Matlab Course Literature N. Bergman and F. Gustafsson, An Introductory Matlab Course with Engineering Applications, Springer, 2002 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

8 Introduction to Matlab Course Guide Schedule Information Registration Examination

9 Introduction to Matlab Course Guide - Registration Internet Internet Server Participant A Participant B Participant database

10 Introduction to Matlab Course Guide - Registration Registration is mandatory, both At the course webpage (to receive info, exam) At your kansli (to get credits in LADOK) Take care of this today! (avoids frustration later) Note: kansli = Study administrative office

11 Introduction to Matlab Studies Self studies, guided tours Supervised computer sessions Questions via Examination over WWW Participant A Participant B ? !

12 Introduction to Matlab Self studies - Availability The KTH CD-rom Matlab is installed in most computer labs On Linux machines at Elektro type Any changes will be posted at course web page module add matlab matlab

13 Introduction to Matlab Computer Exercises You will need account at Elektro 1.Register for course (necessary!) 2.Contact course administrator Magdalena Lindqvist, Osquldasv. 10, floor 6. (or 3.Two days later, the account can be checked out at Elhand, Osquldas v 10, floor 2. - bring identity card!

14 Introduction to Matlab Exam Distributed via WWW 1.Request exam from web-server 2.Allows you to download Matlab program that a.Given your personal number, generate problems b.Corrects and marks your code, returns string. 3. Submitstring to server within 72 hours. Grades via . Four problems, drawn from the following categories 1.Basic matrix manipulations 2.Operations on string variables (not covered in lectures) 3.Writing functions 4.Flow control 5.Function functions Program well – fast programs give higher score!

15 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

16 Introduction to Matlab Part II – Matlab Basics

17 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)

18 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.

19 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 !?

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

21 Introduction to Matlab Interactive Calculations 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

22 Introduction to Matlab Interactive Calculations 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

23 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]

24 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.

25 Introduction to Matlab Matrix functions Elementary functions are also overloaded >> sin(A) >> help elmat; help elfun Specialized matrix functions and operators >> sqrtm(A) >> A^2 >> A.^2 >> A.*B Note: in general,. is elementwise operation

26 Introduction to Matlab Numerical Linear Algebra Numerical linear algebra >> inv(A) >> B\A >> det(A) >> rank(A) The number of input/output arguments can often be varied >> [V,D]=eig(A)

27 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)]

28 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

29 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, 2); Many other plot functions available >> v=1:4; pie(v)

30 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

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

32 Introduction to Matlab Next Lecture Programming in MATLAB