Contents. MATLAB Tutorial. Contents. General Functions. What is MATLAB? Calculations at the Command Line

Save this PDF as:
 WORD  PNG  TXT  JPG

Size: px
Start display at page:

Download "Contents. MATLAB Tutorial. Contents. General Functions. What is MATLAB? Calculations at the Command Line"

Transcription

1 Contents MATLAB Tutorial Based on Matlab Tutorial What Matlab? Matrices Numerical Arrays String Arrays Elementary Math Logical Operators Math Functions Importing and Exporting Data 2 Contents Graphics Fundamentals 2D plotting Subplots 3D plotting Editing and Debugging M-files Script and Function Files Basic Parts of an M-file Flow Control Statements M-file Programming Data Types Continued What MATLAB? high-performance software Computation Vualization Easy-to-use environment. high-level language Data types Functions Control flow statements Input/output Graphics Object-oriented programming capabilities 3 5 Calculations at the Command Line General Functions 9 MATLAB as a calculator Assigning Variables» -5/( )^2 ans» a 2; ans 2; -.488» b 5; ;» (3+4i)*(3-4i)» a^b a^b ans ans ans ans » cos(pi/2)» x 5/2*pi; 5/2*pi; ans ans» y sin(x) 6.23e-7 sin(x) y» exp(acos(.3)) ans ans 3.547» z asin(y) asin(y) z A Note about Workspace: Numbers stored in double-precion floating point format Semicolon suppresses screen output Results assigned to ans if name not specified () parentheses for function inputs whos: Lt current variables clear: Clear variables and functions from memory cd: Change current working directory ls: Lt files in directory

2 Getting help help command lookfor command Printable Documents Matlabroot\help\pdf_doc\ (>>help) (>>lookfor) Matrices Entering and Generating Matrices Subscripts Scalar Expansion Concatenation Deleting Rows and Columns Array Extraction Matrix and Array Multiplication 2 Entering Numeric Arrays The Matrix in MATLAB 3 Row separator semicolon (;) Column separator space / comma (,)» a[ a[ 2;3 2;3 4] 4] a Use square 2 brackets [ ] 3 4» b[-2.8, b[-2.8, sqrt(-7), sqrt(-7), (3+5+6)*3/4] (3+5+6)*3/4] b i i.5.5» b(2,5) b(2,5) b i i Any MATLAB expression can be entered as a matrix element Matrices must be rectangular. (Set undefined elements to zero) 4 A 2 Rows (m) Columns (n) A (2,4) A (7) Rectangular Matrix: Scalar: -by- array Vector: m-by- array -by-n array Matrix: m-by-n array Entering Numeric Arrays Numerical Array Concatenation 5 Scalar expansion Creating sequences: colon operator (:) Utility functions for creating matrices.» w[ w[ 2;3 2;3 4] 4] + 5 w » x :5 :5 x » y 2:-.5: 2:-.5: y » z rand(2,4) rand(2,4) z Use [ ] to combine exting arrays as matrix elements Row separator: semicolon (;) Column separator: space / comma (,)» a[ a[ 2;3 2;3 4] 4] a Use square 2 brackets [ ] 3 4» cat_a[a, cat_a[a, 2*a; 2*a; 3*a, 3*a, 4*a; 4*a; 5*a, 5*a, 6*a] 6*a] cat_a cat_a *a Note: The resulting matrix must be rectangular

3 Deleting Rows and Columns Array Subscripting / Indexing» A[ A[ 5 9;4 9; ; 2.5;.. 3i+] 3i+] A i.+3.i» A(:,2)[] A(:,2)[] A i 3.i» A(2,2)[] A(2,2)[]?????? Indexed Indexed empty empty matrix matrix assignment assignment not not allowed. allowed. A A(3,) A(3) A(:5,5) A(:,) A(:,5) A(:,) A(2:25) A(2:) A(4:5,2:3) A([9 4; 5]) Matrix Multiplication» a [ [ 2 3 4; 4; ]; 8];» b ones(4,3); ones(4,3);» c a*b a*b c Array Multiplication [2x4]*[4x3] [2x4] [4x3] [2x3] a(2nd row).b(3rd column)» a [ [ 2 3 4; 4; ]; 8];» b [:4; [:4; :4]; :4];» c a.*b a.*b c c(2,4) a(2,4)*b(2,4) 2 Matrix Manipulation Functions zeros: Create an array of all zeros ones: Create an array of all ones eye: Identity Matrix rand: Uniformly dtributed random numbers diag: Diagonal matrices and diagonal of a matrix size: Return array dimensions repmat: Replicate and tile a matrix Matrix Manipulation Functions Elementary Math det: Matrix determinant inv: Matrix inverse eig: Evaluate eigenvalues and eigenvectors rank: Rank of matrix Logical Operators Math Functions Polynomial and Interpolation 2 25

4 Logical Operations Elementary Math Function 26 equal to > greater than < less than > Greater or equal < less or equal ~ not & and or finite(), etc.... all(), any() find» Mass Mass [-2 [-2 NaN NaN Inf Inf 3]; 3];» each_pos each_pos Mass> Mass> each_pos each_pos» all(mass>) all(mass>)» any(mass>) any(mass>)» pos_fin pos_fin (Mass>)&(finite(Mass)) (Mass>)&(finite(Mass)) pos_fin pos_fin Note: TRUE FALSE 27 abs, sign: Absolute value and Signum Function sin, cos, asin, acos : Triangular functions exp, log, log: Exponential, Natural and Common (base ) logarithm ceil, floor: Round toward infinities fix: Round toward zero Elementary Math Function round: Round to the nearest integer sqrt: Square root function real, imag: Real and Image part of complex rem: Remainder after divion Elementary Math Function max, min: Maximum and Minimum of arrays mean, median: Average and Median of arrays std, var: Standard deviation and variance sort: Sort elements in ascing order sum, prod: Summation & Product of Elements 28 Importing and Exporting Data Using the Import Wizard Using Save and Load command Input/Output for Text File Read formatted data, reusing the format string N times.»[a An]textread(filename,format,N) save save fname fname save save fname fname x y z save save fname fname -ascii save save fname fname -mat -mat load load fname fname load load fname fname x y z load load fname fname -ascii load load fname fname -mat -mat Import and Exporting Numeric Data with General ASCII delimited files» M dlmread(filename,delimiter,range) 32 33

5 Graphics Fundamentals Graphics Basic Plotting plot, title, xlabel, grid, leg, hold, ax Editing Plots Property Editor Mesh and Surface Plots meshgrid, mesh, surf, colorbar, patch, hidden Handle Graphics D Plotting Sample Plot Syntax: Title plot(x, y, y, 'clm', x2, x2, y2, y2, 'clm2',...)...) Example: 37 x[:.:2*pi]; ysin(x); zcos(x); plot(x,y,x,z,'linewidth',2) title('sample Plot','fontsize',4); xlabel('x values','fontsize',4); ylabel('y values','fontsize',4); leg('y data','z data') grid grid on on 38 Ylabel Leg Xlabel Grid Subplots Syntax: subplot(rows,cols,index)»subplot(2,2,);»»subplot(2,2,2)» Surface Plot Example x :.:2; :.:2; y :.:2; :.:2; [xx, [xx, yy] yy] meshgrid(x,y); meshgrid(x,y); zzsin(xx.^2+yy.^2); surf(xx,yy,zz) surf(xx,yy,zz) xlabel('x xlabel('x axes') axes') ylabel('y ylabel('y axes') axes')»subplot(2,2,3)»......»subplot(2,2,4)»

6 3-D Surface Plotting contourf-colorbar-plot3-waterfall-contour3-mesh-surf Specialized Plotting Routines bar-bar3h-ht-area-pie3-rose 4 42 Editing and Debugging M-Files Debugging 43 What an M-File? The Editor/Debugger Search Path Debugging M-Files Types of Errors (Syntax Error and Runtime Error) Using keyboard and ; statement Setting Breakpoints Stepping Through Continue, Go Until Cursor, Step, Step In, Step Out Examining Values Selecting the Workspace Viewing Datatips in the Editor/Debugger Evaluating a Selection 44 Select Workspace Set Auto- Breakpoints tips Script and Function Files Programming and Dubugging Script Files Work as though you typed commands into MATLAB prompt Variable are stored in MATLAB workspace Function Files Let you make your own MATLAB Functions All variables within a function are local All information must be passed to functions as parameters Subfunctions are supported

7 Basic Parts of a Function M-File Flow Control Statements 47 Output Arguments Function Name Input Arguments Online Help function y mean (x) % MEAN Average or mean value. % For vectors, MEAN(x) returns the mean value. % For matrices, MEAN(x) a row vector % containing the mean value of each column. [m,n] size(x); if m Function Code m n; y sum(x)/m; 48 if Statement if if ((attance ((attance > >.9).9) & (grade_average (grade_average > > 6)) 6)) pass pass ; ; ; ; while Loops eps eps ; ; while while (+eps) (+eps) > eps eps eps/2; eps/2; eps eps eps*2 eps*2 49 Flow Control Statements for Loop a a zeros(k,k) zeros(k,k) % % Preallocate Preallocate matrix matrix for for m m :k :k for for n n :k :k a(m,n) a(m,n) /(m+n /(m+n -); -); switch Statement method method 'Bilinear'; 'Bilinear'; switch switch lower(method) lower(method) case case {'linear','bilinear'} {'linear','bilinear'} dp('method dp('method linear') linear') case case 'cubic' 'cubic' dp('method dp('method cubic') cubic') otherwe otherwe dp('unknown dp('unknown method.') method.') Method Method linear linear 5 M-file Programming Features SubFunctions Varying number of input/output arguments Local and Global Variables Obtaining User Input Prompting for Keyboard Input Pausing During Execution Errors and Warnings Dplaying error and warning Messages Shell Escape Functions (! Operator) Optimizing MATLAB Code Vectorizing loops Preallocating Arrays Function M-file Data Types function function r ourrank(x,tol) ourrank(x,tol) % rank rank of of a matrix matrix s svd(x); svd(x); if if (nargin (nargin ) ) tol tol max(size(x)) max(size(x)) * s()* s()* eps; eps; r sum(s sum(s > tol); tol); Multiple Input Arguments use ( )»rourrank(rand(5),.); 5 function function [mean,stdev] [mean,stdev] ourstat(x) ourstat(x) [m,n] [m,n] size(x); Multiple Output size(x); if if m Arguments, use [ ] m n; n;»[m std]ourstat(:9); mean mean sum(x)/m; sum(x)/m; stdev stdev sqrt(sum(x.^2)/m sqrt(sum(x.^2)/m mean.^2); mean.^2); 52 Numeric Arrays Multidimensional Arrays Structures and Cell Arrays

8 Multidimensional Arrays Structures 53 The first references array dimension, the row. The second references dimension 2, the column. The third references dimension 3, The page Page Page N» A pascal(4);» A(:,:,2) A(:,:,2) magic(4) magic(4) A(:,:,) A(:,:,) A(:,:,2) A(:,:,2) » A(:,:,9) A(:,:,9) diag(ones(,4)); 54 Arrays with named data containers called fields.» patient.name'john Doe'; Doe';» patient.billing 27.;» patient.test [79 [ ; 73; ; ]; 25]; Also, Build structure arrays using the struct function. Array of structures» patient(2).name'katty Thomson';» Patient(2).billing.;» Patient(2).test [69 [ ; 33; ; ]; 25]; Cell Arrays Array for which the elements are cells and can hold other MATLAB arrays of different types.» A(,) {[ {[ 4 3; 3; 5 8; 8; 7 2 9]}; 9]};» A(,2) {'Anne Smith'};» A(2,) {3+7i};» A(2,2) {-pi:pi/:pi}; Next Tutorial Session Image Processing Toolbox Movie Making Problem Set 55 Using braces {} to point to elements of cell array Using celldp function to dplay cell array Getting more help Contact You can find more help and FAQ about mathworks products on th page. Getting started with Matlab tarted/index.html Matlab Primer Questions?? 69 7

A Quick Tutorial on MATLAB. Gowtham Bellala

A Quick Tutorial on MATLAB. Gowtham Bellala A Quick Tutorial on MATLAB Gowtham Bellala MATLAB MATLAB is a software package for doing numerical computation. It was originally designed for solving linear algebra type problems using matrices. It s

More information

Introduction to Matlab

Introduction to Matlab Introduction to Matlab Social Science Research Lab American University, Washington, D.C. Web. www.american.edu/provost/ctrl/pclabs.cfm Tel. x3862 Email. SSRL@American.edu Course Objective This course provides

More information

Introduction to Matlab (Code)

Introduction to Matlab (Code) Introduction to Matlab (Code) intro.m Introduction to Matlab (1) Basics The symbol "" is used to indicate a comment (for the remainder of the line). When writing a long Matlab statement that becomes to

More information

b) lower case always use lower case for all matlab commands. This is what matlab recognizes.

b) lower case always use lower case for all matlab commands. This is what matlab recognizes. 1 Matlab 1) Fundamentals a) Getting Help for more detailed help on any topic, typing help, then a space, and then the matlab command brings up a detailed page on the command or topic. For really difficult

More information

Financial Econometrics MFE MATLAB Introduction. Kevin Sheppard University of Oxford

Financial Econometrics MFE MATLAB Introduction. Kevin Sheppard University of Oxford Financial Econometrics MFE MATLAB Introduction Kevin Sheppard University of Oxford October 21, 2013 2007-2013 Kevin Sheppard 2 Contents Introduction i 1 Getting Started 1 2 Basic Input and Operators 5

More information

MATLAB Functions. function [Out_1,Out_2,,Out_N] = function_name(in_1,in_2,,in_m)

MATLAB Functions. function [Out_1,Out_2,,Out_N] = function_name(in_1,in_2,,in_m) MATLAB Functions What is a MATLAB function? A MATLAB function is a MATLAB program that performs a sequence of operations specified in a text file (called an m-file because it must be saved with a file

More information

Command lookfor followed by a key word (which can be anything and not only a command) gives help related to the key word.

Command lookfor followed by a key word (which can be anything and not only a command) gives help related to the key word. 1 Using MatLab Help Command help provides a short description of all functions. For example, to get help on the diary command, type help diary. For more information type help -i diary. Command lookfor

More information

Introduction. Chapter 1

Introduction. Chapter 1 Chapter 1 Introduction MATLAB (Matrix laboratory) is an interactive software system for numerical computations and graphics. As the name suggests, MATLAB is especially designed for matrix computations:

More information

u = [ 2 4 5] has one row with three components (a 3 v = [2 4 5] has three rows separated by semicolons (a 3 w = 2:5 generates the row vector w = [ 2 3

u = [ 2 4 5] has one row with three components (a 3 v = [2 4 5] has three rows separated by semicolons (a 3 w = 2:5 generates the row vector w = [ 2 3 MATLAB Tutorial You need a small numb e r of basic commands to start using MATLAB. This short tutorial describes those fundamental commands. You need to create vectors and matrices, to change them, and

More information

MATLAB Basics MATLAB numbers and numeric formats

MATLAB Basics MATLAB numbers and numeric formats MATLAB Basics MATLAB numbers and numeric formats All numerical variables are stored in MATLAB in double precision floating-point form. (In fact it is possible to force some variables to be of other types

More information

Basic Concepts in Matlab

Basic Concepts in Matlab Basic Concepts in Matlab Michael G. Kay Fitts Dept. of Industrial and Systems Engineering North Carolina State University Raleigh, NC 769-7906, USA kay@ncsu.edu September 00 Contents. The Matlab Environment.

More information

Kerby Shedden October, 2007. Overview of R

Kerby Shedden October, 2007. Overview of R Kerby Shedden October, 2007 Overview of R R R is a programming language for statistical computing, data analysis, and graphics. It is a re-implementation of the S language, which was developed in the 1980

More information

Introductory Course to Matlab with Financial Case Studies

Introductory Course to Matlab with Financial Case Studies University of Cyprus Public Business Administration Department Introductory Course to Matlab with Financial Case Studies Prepared by: Panayiotis Andreou PhD Candidate PBA UCY Lefkosia, September 003 Table

More information

Einführung in MATLAB Sommer Campus 2004

Einführung in MATLAB Sommer Campus 2004 Einführung in MATLAB Sommer Campus 2004 Teil I G.Brunner, B. Haasdonk, K. Peschke Lehrstuhl für Mustererkennung und Bildverarbeitung Uni Freiburg Seite 1 Einteilung des Kurses Teil 1 (Mittwoch) allgemeine

More information

CD-ROM Appendix E: Matlab

CD-ROM Appendix E: Matlab CD-ROM Appendix E: Matlab Susan A. Fugett Matlab version 7 or 6.5 is a very powerful tool useful for many kinds of mathematical tasks. For the purposes of this text, however, Matlab 7 or 6.5 will be used

More information

Introduction to MATLAB (Basics) Reference from: Azernikov Sergei mesergei@tx.technion.ac.il

Introduction to MATLAB (Basics) Reference from: Azernikov Sergei mesergei@tx.technion.ac.il Introduction to MATLAB (Basics) Reference from: Azernikov Sergei mesergei@tx.technion.ac.il MATLAB Basics Where to get help? 1) In MATLAB s prompt type: help, lookfor,helpwin, helpdesk, demos. 2) On the

More information

Engineering Problem Solving and Excel. EGN 1006 Introduction to Engineering

Engineering Problem Solving and Excel. EGN 1006 Introduction to Engineering Engineering Problem Solving and Excel EGN 1006 Introduction to Engineering Mathematical Solution Procedures Commonly Used in Engineering Analysis Data Analysis Techniques (Statistics) Curve Fitting techniques

More information

MATLAB LECTURE NOTES. Dr. ADİL YÜCEL. Istanbul Technical University Department of Mechanical Engineering

MATLAB LECTURE NOTES. Dr. ADİL YÜCEL. Istanbul Technical University Department of Mechanical Engineering MATLAB LECTURE NOTES Dr. ADİL YÜCEL Istanbul Technical University Department of Mechanical Engineering MATLAB LECTURE NOTES Student Name Student ID Dr. ADİL YÜCEL Istanbul Technical University Department

More information

INTRODUCTION TO MATLAB FOR ENGINEERING STUDENTS

INTRODUCTION TO MATLAB FOR ENGINEERING STUDENTS INTRODUCTION TO MATLAB FOR ENGINEERING STUDENTS David Houcque Northwestern University (version 1.2, August 2005) Contents 1 Tutorial lessons 1 1 1.1 Introduction.................................... 1 1.2

More information

Appendix: Tutorial Introduction to MATLAB

Appendix: Tutorial Introduction to MATLAB Resampling Stats in MATLAB 1 This document is an excerpt from Resampling Stats in MATLAB Daniel T. Kaplan Copyright (c) 1999 by Daniel T. Kaplan, All Rights Reserved This document differs from the published

More information

SMART Notebook Math Tools. User s Guide

SMART Notebook Math Tools. User s Guide SMART Notebook Math Tools User s Guide The content of this guide is provided for informational purposes only and is subject to change without notice. Trademark Notice SMART Board, SMART Notebook, the SMART

More information

2+2 Just type and press enter and the answer comes up ans = 4

2+2 Just type and press enter and the answer comes up ans = 4 Demonstration Red text = commands entered in the command window Black text = Matlab responses Blue text = comments 2+2 Just type and press enter and the answer comes up 4 sin(4)^2.5728 The elementary functions

More information

How long is the vector? >> length(x) >> d=size(x) % What are the entries in the matrix d?

How long is the vector? >> length(x) >> d=size(x) % What are the entries in the matrix d? MATLAB : A TUTORIAL 1. Creating vectors..................................... 2 2. Evaluating functions y = f(x), manipulating vectors. 4 3. Plotting............................................ 5 4. Miscellaneous

More information

PGR Computing Programming Skills

PGR Computing Programming Skills PGR Computing Programming Skills Dr. I. Hawke 2008 1 Introduction The purpose of computing is to do something faster, more efficiently and more reliably than you could as a human do it. One obvious point

More information

MATLAB Tutorial. Chapter 6. Writing and calling functions

MATLAB Tutorial. Chapter 6. Writing and calling functions MATLAB Tutorial Chapter 6. Writing and calling functions In this chapter we discuss how to structure a program with multiple source code files. First, an explanation of how code files work in MATLAB is

More information

(!' ) "' # "*# "!(!' +,

(!' ) ' # *# !(!' +, MATLAB is a numeric computation software for engineering and scientific calculations. The name MATLAB stands for MATRIX LABORATORY. MATLAB is primarily a tool for matrix computations. It was developed

More information

Beginner s Matlab Tutorial

Beginner s Matlab Tutorial Christopher Lum lum@u.washington.edu Introduction Beginner s Matlab Tutorial This document is designed to act as a tutorial for an individual who has had no prior experience with Matlab. For any questions

More information

MATLAB DFS. Interface Library. User Guide

MATLAB DFS. Interface Library. User Guide MATLAB DFS Interface Library User Guide DHI Water Environment Health Agern Allé 5 DK-2970 Hørsholm Denmark Tel: +45 4516 9200 Fax: +45 4516 9292 E-mail: dhi@dhigroup.com Web: www.dhigroup.com 2007-03-07/MATLABDFS_INTERFACELIBRARY_USERGUIDE.DOC/JGR/HKH/2007Manuals/lsm

More information

Basic R Commands: Comments

Basic R Commands: Comments Basic R Commands: Comments If you want to insert a comment (i.e., non-executable commands) anywhere in a program, you need to preface the line of code with a # sign. Everything in the line after the #

More information

AMATH 352 Lecture 3 MATLAB Tutorial Starting MATLAB Entering Variables

AMATH 352 Lecture 3 MATLAB Tutorial Starting MATLAB Entering Variables AMATH 352 Lecture 3 MATLAB Tutorial MATLAB (short for MATrix LABoratory) is a very useful piece of software for numerical analysis. It provides an environment for computation and the visualization. Learning

More information

MAT 275 Laboratory 1 Introduction to MATLAB

MAT 275 Laboratory 1 Introduction to MATLAB MAT 275 Laboratory 1 Introduction to MATLAB MATLAB is a computer software commonly used in both education and industry to solve a wide range of problems. This Laboratory provides a brief introduction to

More information

Part VI. Scientific Computing in Python

Part VI. Scientific Computing in Python Part VI Scientific Computing in Python Compact Course @ GRS, June 03-07, 2013 80 More on Maths Module math Constants pi and e Functions that operate on int and float All return values float ceil (x) floor

More information

MATLAB Programming. Problem 1: Sequential

MATLAB Programming. Problem 1: Sequential Division of Engineering Fundamentals, Copyright 1999 by J.C. Malzahn Kampe 1 / 21 MATLAB Programming When we use the phrase computer solution, it should be understood that a computer will only follow directions;

More information

Simple Programming in MATLAB. Plotting a graph using MATLAB involves three steps:

Simple Programming in MATLAB. Plotting a graph using MATLAB involves three steps: Simple Programming in MATLAB Plotting Graphs: We will plot the graph of the function y = f(x) = e 1.5x sin(8πx), 0 x 1 Plotting a graph using MATLAB involves three steps: Create points 0 = x 1 < x 2

More information

Simulation Tools. Python for MATLAB Users I. Claus Führer. Automn 2009. Claus Führer Simulation Tools Automn 2009 1 / 65

Simulation Tools. Python for MATLAB Users I. Claus Führer. Automn 2009. Claus Führer Simulation Tools Automn 2009 1 / 65 Simulation Tools Python for MATLAB Users I Claus Führer Automn 2009 Claus Führer Simulation Tools Automn 2009 1 / 65 1 Preface 2 Python vs Other Languages 3 Examples and Demo 4 Python Basics Basic Operations

More information

Texas Instruments TI-83, TI-83 Plus Graphics Calculator I.1 Systems of Linear Equations

Texas Instruments TI-83, TI-83 Plus Graphics Calculator I.1 Systems of Linear Equations Part I: Texas Instruments TI-83, TI-83 Plus Graphics Calculator I.1 Systems of Linear Equations I.1.1 Basics: Press the ON key to begin using your TI-83 calculator. If you need to adjust the display contrast,

More information

6.094 Introduction to Programming in MATLAB

6.094 Introduction to Programming in MATLAB 6.094 Introduction to Programming in MATLAB Lecture 1: Variables, Scripts, and Operations Danilo Šćepanović IAP 2010 Course Layout Lectures 1: Variables, Scripts and Operations 2: Visualization and Programming

More information

SOME EXCEL FORMULAS AND FUNCTIONS

SOME EXCEL FORMULAS AND FUNCTIONS SOME EXCEL FORMULAS AND FUNCTIONS About calculation operators Operators specify the type of calculation that you want to perform on the elements of a formula. Microsoft Excel includes four different types

More information

Signal Processing First Lab 01: Introduction to MATLAB. 3. Learn a little about advanced programming techniques for MATLAB, i.e., vectorization.

Signal Processing First Lab 01: Introduction to MATLAB. 3. Learn a little about advanced programming techniques for MATLAB, i.e., vectorization. Signal Processing First Lab 01: Introduction to MATLAB Pre-Lab and Warm-Up: You should read at least the Pre-Lab and Warm-up sections of this lab assignment and go over all exercises in the Pre-Lab section

More information

Analysis of System Performance IN2072 Chapter M Matlab Tutorial

Analysis of System Performance IN2072 Chapter M Matlab Tutorial Chair for Network Architectures and Services Prof. Carle Department of Computer Science TU München Analysis of System Performance IN2072 Chapter M Matlab Tutorial Dr. Alexander Klein Prof. Dr.-Ing. Georg

More information

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program. Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to

More information

5: Magnitude 6: Convert to Polar 7: Convert to Rectangular

5: Magnitude 6: Convert to Polar 7: Convert to Rectangular TI-NSPIRE CALCULATOR MENUS 1: Tools > 1: Define 2: Recall Definition --------------- 3: Delete Variable 4: Clear a-z 5: Clear History --------------- 6: Insert Comment 2: Number > 1: Convert to Decimal

More information

Beginning Matlab Exercises

Beginning Matlab Exercises Beginning Matlab Exercises R. J. Braun Department of Mathematical Sciences University of Delaware 1 Introduction This collection of exercises is inted to help you start learning Matlab. Matlab is a huge

More information

Introduction to Matlab: Application to Electrical Engineering

Introduction to Matlab: Application to Electrical Engineering Introduction to Matlab: Application to Electrical Engineering Houssem Rafik El Hana Bouchekara Umm El Qura University (version 1, Februray 2011) 1 Contents 1 CHAPTER 1... 7 1.1 TUTORIAL LESSONS 1... 7

More information

C programming: exercise sheet L2-STUE (2011-2012)

C programming: exercise sheet L2-STUE (2011-2012) C programming: exercise sheet L2-STUE (2011-2012) Algorithms and Flowcharts Exercise 1: comparison Write the flowchart and associated algorithm that compare two numbers a and b. Exercise 2: 2 nd order

More information

FIRST STEPS WITH SCILAB

FIRST STEPS WITH SCILAB powered by FIRST STEPS WITH SCILAB The purpose of this tutorial is to get started using Scilab, by discovering the environment, the main features and some useful commands. Level This work is licensed under

More information

Exercise 0. Although Python(x,y) comes already with a great variety of scientic Python packages, we might have to install additional dependencies:

Exercise 0. Although Python(x,y) comes already with a great variety of scientic Python packages, we might have to install additional dependencies: Exercise 0 Deadline: None Computer Setup Windows Download Python(x,y) via http://code.google.com/p/pythonxy/wiki/downloads and install it. Make sure that before installation the installer does not complain

More information

Tutorial Program. 1. Basics

Tutorial Program. 1. Basics 1. Basics Working environment Dealing with matrices Useful functions Logical operators Saving and loading Data management Exercises 2. Programming Basics graphics settings - ex Functions & scripts Vectorization

More information

Matlab Tutorial Francesco Franco

Matlab Tutorial Francesco Franco Matlab Tutorial Francesco Franco Matlab is a software package that makes it easier for you to enter matrices and vectors, and manipulate them. The interface follows a language that is designed to look

More information

Linear Algebra and TI 89

Linear Algebra and TI 89 Linear Algebra and TI 89 Abdul Hassen and Jay Schiffman This short manual is a quick guide to the use of TI89 for Linear Algebra. We do this in two sections. In the first section, we will go over the editing

More information

MATLAB Primer. R2015b

MATLAB Primer. R2015b MATLAB Primer R25b How to Contact MathWorks Latest news: www.mathworks.com Sales and services: www.mathworks.com/sales_and_services User community: www.mathworks.com/matlabcentral Technical support: www.mathworks.com/support/contact_us

More information

Programming in MATLAB

Programming in MATLAB University of Southern Denmark An introductory set of notes Programming in MATLAB Authors: Nicky C. Mattsson Christian D. Jørgensen Web pages: imada.sdu.dk/ nmatt11 imada.sdu.dk/ chjoe11 November 10, 2014

More information

Scripting with TCL, Part 1

Scripting with TCL, Part 1 Scripting with TCL, Part 1 Axel Kohlmeyer Center for Molecular Modeling University of Pennsylvania SBS 2007 @ JNCASR, Bangalore The VMD Execution Model GUI (FLTK) Internal State Visualization Python Interpreter

More information

MAS 500 Intelligence Tips and Tricks Booklet Vol. 1

MAS 500 Intelligence Tips and Tricks Booklet Vol. 1 MAS 500 Intelligence Tips and Tricks Booklet Vol. 1 1 Contents Accessing the Sage MAS Intelligence Reports... 3 Copying, Pasting and Renaming Reports... 4 To create a new report from an existing report...

More information

A few useful MATLAB functions

A few useful MATLAB functions A few useful MATLAB functions Renato Feres - Math 350 Fall 2012 1 Uniform random numbers The Matlab command rand is based on a popular deterministic algorithm called multiplicative congruential method.

More information

Programming Exercise 3: Multi-class Classification and Neural Networks

Programming Exercise 3: Multi-class Classification and Neural Networks Programming Exercise 3: Multi-class Classification and Neural Networks Machine Learning November 4, 2011 Introduction In this exercise, you will implement one-vs-all logistic regression and neural networks

More information

G563 Quantitative Paleontology. SQL databases. An introduction. Department of Geological Sciences Indiana University. (c) 2012, P.

G563 Quantitative Paleontology. SQL databases. An introduction. Department of Geological Sciences Indiana University. (c) 2012, P. SQL databases An introduction AMP: Apache, mysql, PHP This installations installs the Apache webserver, the PHP scripting language, and the mysql database on your computer: Apache: runs in the background

More information

Introduction to Computing I - MATLAB

Introduction to Computing I - MATLAB I - MATLAB Jonathan Mascie-Taylor (Slides originally by Quentin CAUDRON) Centre for Complexity Science, University of Warwick Outline 1 Preamble 2 Computing 3 Introductory MATLAB Variables and Syntax Plotting

More information

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS. + + x 2. x n. a 11 a 12 a 1n b 1 a 21 a 22 a 2n b 2 a 31 a 32 a 3n b 3. a m1 a m2 a mn b m

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS. + + x 2. x n. a 11 a 12 a 1n b 1 a 21 a 22 a 2n b 2 a 31 a 32 a 3n b 3. a m1 a m2 a mn b m MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS 1. SYSTEMS OF EQUATIONS AND MATRICES 1.1. Representation of a linear system. The general system of m equations in n unknowns can be written a 11 x 1 + a 12 x 2 +

More information

Notes on Determinant

Notes on Determinant ENGG2012B Advanced Engineering Mathematics Notes on Determinant Lecturer: Kenneth Shum Lecture 9-18/02/2013 The determinant of a system of linear equations determines whether the solution is unique, without

More information

Quick Tour of Mathcad and Examples

Quick Tour of Mathcad and Examples Fall 6 Quick Tour of Mathcad and Examples Mathcad provides a unique and powerful way to work with equations, numbers, tests and graphs. Features Arithmetic Functions Plot functions Define you own variables

More information

Linear Algebra Review. Vectors

Linear Algebra Review. Vectors Linear Algebra Review By Tim K. Marks UCSD Borrows heavily from: Jana Kosecka kosecka@cs.gmu.edu http://cs.gmu.edu/~kosecka/cs682.html Virginia de Sa Cogsci 8F Linear Algebra review UCSD Vectors The length

More information

GUI with Matlab - Outline

GUI with Matlab - Outline Technion Electrical Engineering Department May 2004 Signal and Image Processing Laboratory Written By: Yair Moshe 1 GUI with Matlab - Outline 1. Basic Graphics 2. Animation 3. Handle Graphics Objects 4.

More information

MATH 423 Linear Algebra II Lecture 38: Generalized eigenvectors. Jordan canonical form (continued).

MATH 423 Linear Algebra II Lecture 38: Generalized eigenvectors. Jordan canonical form (continued). MATH 423 Linear Algebra II Lecture 38: Generalized eigenvectors Jordan canonical form (continued) Jordan canonical form A Jordan block is a square matrix of the form λ 1 0 0 0 0 λ 1 0 0 0 0 λ 0 0 J = 0

More information

Eigenvalues, Eigenvectors, Matrix Factoring, and Principal Components

Eigenvalues, Eigenvectors, Matrix Factoring, and Principal Components Eigenvalues, Eigenvectors, Matrix Factoring, and Principal Components The eigenvalues and eigenvectors of a square matrix play a key role in some important operations in statistics. In particular, they

More information

Texas Instruments TI-92 Graphics Calculator Systems of Linear Equations

Texas Instruments TI-92 Graphics Calculator Systems of Linear Equations Part IV: IV.1 Texas Instruments TI-92 Graphics Calculator Systems of Linear Equations IV.1.1 Basics: Press the ON key to begin using your TI-92 calculator. If you need to adjust the display contrast, first

More information

Computational Mathematics with Python

Computational Mathematics with Python Boolean Arrays Classes Computational Mathematics with Python Basics Olivier Verdier and Claus Führer 2009-03-24 Olivier Verdier and Claus Führer Computational Mathematics with Python 2009-03-24 1 / 40

More information

Simply Accounting Intelligence Tips and Tricks Booklet Vol. 1

Simply Accounting Intelligence Tips and Tricks Booklet Vol. 1 Simply Accounting Intelligence Tips and Tricks Booklet Vol. 1 1 Contents Accessing the SAI reports... 3 Running, Copying and Pasting reports... 4 Creating and linking a report... 5 Auto e-mailing reports...

More information

Lecture 7 Cogsci 109. Thurs. Oct. 12, 2006

Lecture 7 Cogsci 109. Thurs. Oct. 12, 2006 Lecture 7 Cogsci 109 Thurs. Oct. 12, 2006 Announcements Homework 2 is posted. Office hours Midterm is coming up somewhere in the next couple of weeks Anything lectured on, presented in section, in the

More information

Data Tool Platform SQL Development Tools

Data Tool Platform SQL Development Tools Data Tool Platform SQL Development Tools ekapner Contents Setting SQL Development Preferences...5 Execution Plan View Options Preferences...5 General Preferences...5 Label Decorations Preferences...6

More information

PTC Mathcad Prime 3.0 Keyboard Shortcuts

PTC Mathcad Prime 3.0 Keyboard Shortcuts PTC Mathcad Prime 3.0 Shortcuts Swedish s Regions Inserting Regions Operator/Command Description Shortcut Swedish Area Inserts a collapsible area you can collapse or expand to toggle the display of your

More information

MATLAB MANUAL AND INTRODUCTORY TUTORIALS

MATLAB MANUAL AND INTRODUCTORY TUTORIALS MATLAB MANUAL AND INTRODUCTORY TUTORIALS Ivan Graham, with some revisions by Nick Britton, Mathematical Sciences, University of Bath February 9, 2005 This manual provides an introduction to MATLAB with

More information

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS Systems of Equations and Matrices Representation of a linear system The general system of m equations in n unknowns can be written a x + a 2 x 2 + + a n x n b a

More information

Introduction to Numerical Math and Matlab Programming

Introduction to Numerical Math and Matlab Programming Introduction to Numerical Math and Matlab Programming Todd Young and Martin Mohlenkamp Department of Mathematics Ohio University Athens, OH 45701 young@math.ohiou.edu c 2009 - Todd Young and Martin Mohlenkamp.

More information

MatLab Basics. Now, press return to see what Matlab has stored as your variable x. You should see:

MatLab Basics. Now, press return to see what Matlab has stored as your variable x. You should see: MatLab Basics MatLab was designed as a Matrix Laboratory, so all operations are assumed to be done on matrices unless you specifically state otherwise. (In this context, numbers (scalars) are simply regarded

More information

Presentation 3: Eigenvalues and Eigenvectors of a Matrix

Presentation 3: Eigenvalues and Eigenvectors of a Matrix Colleen Kirksey, Beth Van Schoyck, Dennis Bowers MATH 280: Problem Solving November 18, 2011 Presentation 3: Eigenvalues and Eigenvectors of a Matrix Order of Presentation: 1. Definitions of Eigenvalues

More information

(!' ) "' # "*# "!(!' +,

(!' ) ' # *# !(!' +, Normally, when single line commands are entered, MATLAB processes the commands immediately and displays the results. MATLAB is also capable of processing a sequence of commands that are stored in files

More information

AIMMS Function Reference - Arithmetic Functions

AIMMS Function Reference - Arithmetic Functions AIMMS Function Reference - Arithmetic Functions This file contains only one chapter of the book. For a free download of the complete book in pdf format, please visit www.aimms.com Aimms 3.13 Part I Function

More information

2.1: MATRIX OPERATIONS

2.1: MATRIX OPERATIONS .: MATRIX OPERATIONS What are diagonal entries and the main diagonal of a matrix? What is a diagonal matrix? When are matrices equal? Scalar Multiplication 45 Matrix Addition Theorem (pg 0) Let A, B, and

More information

Computational Mathematics with Python

Computational Mathematics with Python Numerical Analysis, Lund University, 2011 1 Computational Mathematics with Python Chapter 1: Basics Numerical Analysis, Lund University Claus Führer, Jan Erik Solem, Olivier Verdier, Tony Stillfjord Spring

More information

Computational Mathematics with Python

Computational Mathematics with Python Computational Mathematics with Python Basics Claus Führer, Jan Erik Solem, Olivier Verdier Spring 2010 Claus Führer, Jan Erik Solem, Olivier Verdier Computational Mathematics with Python Spring 2010 1

More information

Chapter 5 Functions. Introducing Functions

Chapter 5 Functions. Introducing Functions Chapter 5 Functions 1 Introducing Functions A function is a collection of statements that are grouped together to perform an operation Define a function Invoke a funciton return value type method name

More information

Summary: Transformations. Lecture 14 Parameter Estimation Readings T&V Sec 5.1-5.3. Parameter Estimation: Fitting Geometric Models

Summary: Transformations. Lecture 14 Parameter Estimation Readings T&V Sec 5.1-5.3. Parameter Estimation: Fitting Geometric Models Summary: Transformations Lecture 14 Parameter Estimation eadings T&V Sec 5.1-5.3 Euclidean similarity affine projective Parameter Estimation We will talk about estimating parameters of 1) Geometric models

More information

Intermediate Python Tutorial

Intermediate Python Tutorial Intermediate Python Tutorial Python is free software and is an easy to learn powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented

More information

13 MATH FACTS 101. 2 a = 1. 7. The elements of a vector have a graphical interpretation, which is particularly easy to see in two or three dimensions.

13 MATH FACTS 101. 2 a = 1. 7. The elements of a vector have a graphical interpretation, which is particularly easy to see in two or three dimensions. 3 MATH FACTS 0 3 MATH FACTS 3. Vectors 3.. Definition We use the overhead arrow to denote a column vector, i.e., a linear segment with a direction. For example, in three-space, we write a vector in terms

More information

Linear Algebra and Introduction to MATLAB. Sabine Eschenhof

Linear Algebra and Introduction to MATLAB. Sabine Eschenhof Linear Algebra and Introduction to MATLAB Sabine Eschenhof Contents 1 Introduction and Motivation 1 2 Vectors in n-dimensional Spaces 1 21 Elementary Operations 2 22 Linear Independence, Span and Basis

More information

SYSM 6304: Risk and Decision Analysis Lecture 3 Monte Carlo Simulation

SYSM 6304: Risk and Decision Analysis Lecture 3 Monte Carlo Simulation SYSM 6304: Risk and Decision Analysis Lecture 3 Monte Carlo Simulation M. Vidyasagar Cecil & Ida Green Chair The University of Texas at Dallas Email: M.Vidyasagar@utdallas.edu September 19, 2015 Outline

More information

Review Jeopardy. Blue vs. Orange. Review Jeopardy

Review Jeopardy. Blue vs. Orange. Review Jeopardy Review Jeopardy Blue vs. Orange Review Jeopardy Jeopardy Round Lectures 0-3 Jeopardy Round $200 How could I measure how far apart (i.e. how different) two observations, y 1 and y 2, are from each other?

More information

MATLAB Primer. R2015a

MATLAB Primer. R2015a MATLAB Primer R25a How to Contact MathWorks Latest news: www.mathworks.com Sales and services: www.mathworks.com/sales_and_services User community: www.mathworks.com/matlabcentral Technical support: www.mathworks.com/support/contact_us

More information

Part #3. AE0B17MTB Matlab. Pavel Valtr Pavel.Valtr@fel.cvut.cz Miloslav Čapek, Filip Kozák, Viktor Adler

Part #3. AE0B17MTB Matlab. Pavel Valtr Pavel.Valtr@fel.cvut.cz Miloslav Čapek, Filip Kozák, Viktor Adler AE0B17MTB Matlab Part #3 Pavel Valtr Pavel.Valtr@fel.cvut.cz Miloslav Čapek, Filip Kozák, Viktor Adler Department of Electromagnetic Field B2-626, Prague Learning how to Indexing ResTable.data1(... PsoData.cond{crt}(spr,2),...

More information

INTRODUCTION TO EXCEL

INTRODUCTION TO EXCEL INTRODUCTION TO EXCEL 1 INTRODUCTION Anyone who has used a computer for more than just playing games will be aware of spreadsheets A spreadsheet is a versatile computer program (package) that enables you

More information

Introduction to MATLAB

Introduction to MATLAB Introduction to MATLAB MathWorks Logo Markus Kuhn Computer Laboratory, University of Cambridge https://www.cl.cam.ac.uk/teaching/1516/tex+matlab/ Michaelmas 215 Part II 1 What is MATLAB high-level language

More information

Mathematica Tutorial

Mathematica Tutorial Mathematica Tutorial To accompany Partial Differential Equations: Analytical and Numerical Methods, 2nd edition by Mark S. Gockenbach (SIAM, 200) Introduction In this introduction, I will explain the organization

More information

Using Casio Graphics Calculators

Using Casio Graphics Calculators Using Casio Graphics Calculators (Some of this document is based on papers prepared by Donald Stover in January 2004.) This document summarizes calculation and programming operations with many contemporary

More information

Similarity and Diagonalization. Similar Matrices

Similarity and Diagonalization. Similar Matrices MATH022 Linear Algebra Brief lecture notes 48 Similarity and Diagonalization Similar Matrices Let A and B be n n matrices. We say that A is similar to B if there is an invertible n n matrix P such that

More information

The Language of Technical Computing. Computation. Visualization. Programming. MATLAB Programming Tips Version 6

The Language of Technical Computing. Computation. Visualization. Programming. MATLAB Programming Tips Version 6 MATLAB The Language of Technical Computing Computation Visualization Programming MATLAB Programming Tips Version 6 How to Contact The MathWorks: www.mathworks.com comp.soft-sys.matlab support@mathworks.com

More information

PHP Math Functions With Examples pdf

PHP Math Functions With Examples pdf PHP Math Functions With Examples pdf Created By: Umar Farooque Khan 1 Index S. No Topics Page No 1. PHP Abs() Function 03 2. PHP Pow() Function 04 3. PHP Sqrt() Function 06 4. PHP Mt_rand() Function 07

More information

General Guide...3. Before Starting Calculation...4

General Guide...3. Before Starting Calculation...4 General Guide...3 Turning on or off...3 Battery replacement...3 Auto power-off function...3 Reset operation...3 Contrast adjustment...3 Display readout...4 Before Starting Calculation...4 Using " MODE

More information

PLOTTING IN SCILAB. www.openeering.com

PLOTTING IN SCILAB. www.openeering.com powered by PLOTTING IN SCILAB In this Scilab tutorial we make a collection of the most important plots arising in scientific and engineering applications and we show how straightforward it is to create

More information

Department of Chemical Engineering ChE-101: Approaches to Chemical Engineering Problem Solving MATLAB Tutorial VI

Department of Chemical Engineering ChE-101: Approaches to Chemical Engineering Problem Solving MATLAB Tutorial VI Department of Chemical Engineering ChE-101: Approaches to Chemical Engineering Problem Solving MATLAB Tutorial VI Solving a System of Linear Algebraic Equations (last updated 5/19/05 by GGB) Objectives:

More information