AN INTRODUCTION TO MATLAB
|
|
- Adele Mitchell
- 5 years ago
- Views:
Transcription
1 AN INTRODUCTION TO MATLAB 1 Introduction MATLAB is a powerful mathematical tool used for a number of engineering applications such as communication engineering, digital signal processing, control engineering, artificial intelligence, etc Workspace On Windows systems Matlab is started by double clicking on the Matlan icon. On opening MATLAB the Command Window is created and made the active window. The Command Window is the mechanism through which one can communicate with the Matlab interpreter. The interpreter displays it prompt "" on the right hand side of the screen, indicating that it is ready to accept instruction. If after entering instructions Matlab Command Window display no "" then is means that Matlab is still executing the commands. Once finished the symbol "" will be displayed. Type 1 at the command line and press return. The program immediately replies with ans = 1 What has happened is that a variable has been created called ans and the value 1 placed in it. Repeat the procedure with the number 2. Many functions are built into MATLAB from the basic package through to the use of numerous toolboxes specific to a particular application. Typing help lists the top level for the help contents available. MATLAB also provides the user with the common looping and selection statements for building specific programs. 2 Matlab as a Calculator All the basic arithmetic operators *, / and ^ are used together with ( ). ^ is used to show the power: 2^3 = 8. Type in the followings: 3 + 4/6*9 ans = 9 Note: Matlab works according to the priorities as: 1- Quantities in brackets 2- Powers 3- * and /, working left to right 4- + and -, working left to right. 3 Variables 3.1 Scalars: A scalar is a simple variable with one column and one row Creating scalars: To create a scalar assign a value to a name. Try the following and verify z. x = 1; y = 2; z = x + y; Scalar operations: MATLAB supports the standard scalar operations using an obvious notation. The following statements demonstrate scalar addition, subtraction, multiplication and division. u = 5; v = 3; w = u + v x = u - v y = u * v z = u/v 4 Suppressing the Output If the symbol ";" is placed in front of an expression, the value of the variable is calculated but is not shown on the screen. Try this: x=5; y=x*2, z=y+1 y = 10 z = 11 Note: - z exists only as a numerical value, not as the formula. - the value of x is not shown. You may use the "who" command to list all the currently active variables. who Your variables are:
2 ans x y z leaving bytes of memory free. Exercise 4.1: in each case find the value of the expression and explain the order in which the calculation is carried out. i) -3^4+9 ii) 4*5/6 iii) 2*9-5^4-3 iv) (2/4^2+7)*(5-3^2)^4 5 Built-In Functions 5.1 Trigonometric functions: sin, cos, tan Example 5.1: Work out the co-ordinates of a point on a circle of radius 7 centred at the origin with an elevation of 45 o (i.e. π/4 radians): x = 7* cos (pi/4), y = 7 * sin (pi/4) x = y = Other functions: sqrt (for ), exp (for exponential e 2 ), log, log10 (for log 10 ) etc. Exercise 5.1: For x = 9 find sqrt (x), exp (x), log 9x), and log10 (x). 6 Vectors Most calculations in Matlab are vector or matrix manipulations. Vectors (and arrays) are accomplished by using the colon separator, which generates a count of values from a start value to a finish value with a particular increment. The easiest way to enter small matrices is to enter explicit list following these conventions: Separate the explicit list elements with blank or commas. Surround the elements with [ ]. Use ; (the semicolon) to indicate the s of row. The linspace and logspace functions create vectors (row and/or columns) with linearly spaced or logarithmically spaced elements, respectively. Examples: x = linspace(1,5,5) x = y = logspace(1,4,4) y = Assigning vector expressions to a vector Having created a vector, it can be assigned to another vector. x = zeros(1,5); y = x; 6.1 Row vectors: - List of numbers separated by either space or commas, - The number of entries is known as "length", - The entries are referred to as "elements" of the vector. To create a row vector of length 5, filled with ones use x = ones(1,5) b = [1 2, 5 sqrt(6)] b = Note: b is a vector of 4 elements (one row plus 4 columns). length(b) ans = 4 Exercise 6.1: Try out the following and notice the difference that spaces can make: (i) b2 = [ ] (ii) b3 = [ ] Arithmetic operation with vector: This can be done provided the vectors have the same length, see below: b + b3 ans =
3 b4=4*b b4 = b5 =2*b -4*b3 b5 = How about b6 = b + b2? b6=b + b2??? Error using ==> + Matrix dimensions must agree. Vectors can be multiplied by a number (a or it can be added/subtracted to another vector of the SAME LENGTH. The operation are carried out element -byelement. w = [ 2 4 7], z = [9 10] w = z = 9 10 v = [2*z, -w], sort(v) v = Note: The error is because b and b2 do not have the same scalar), ans = Note: v is sorted into descing order by the command sort(v) 6.2 The colon notation: A short cut producing a long vector, as: 1:10 ans = How about vector a = 1:-1? Try this: v = [0:10:100] ans v = It creates a regularly spaced vector (v) containing 11 elements from 0 to 100 at increment of Addressing vector elements Individual elements of a vector can be addressed as follow: x = linspace(11,15,5); x(2) ans = 12 MATLAB automatically interprets the index as the appropriate row or column Increasing the size of a vector (or scalar) Matlab allows you to increase the size of a vector simply by assigning a value to an element that has not been previously used. Examples x = [-1.3 sqrt(3) (1+2+3)*4/5], x = x(5) = abs (x(1)) Assigns the absolute (abs)value of element 1 to the element (column) five. x = Notice that the size of x is automatically increased to accommodate the new element (element 5) and that the undefined intervening elements are set to zero. x = linspace(21,25,5) x = x(7) = -9
4 x = Block of elements at a time: Matlab uses colon notation: r = [1:2:10, -2:-2:-9] r = We are interested in the 3 rd and 6 th elements: r(3:6) ans = Column Vector: Have similar construct to row vector. To create a column vector of length 5, filled with zeros use y = zeros(5,1) Here elements are separated by ";" or "new lines" a = [1; 2; 5; sqrt(6)] a = a2= [ ] a2 = a3 = 2*a - 3*a2 a3 = Transposing Vectors: A row vector can be converted into a column vector (and vice versa) by transposing the vectors, as shown: w, w' w = ans = a, a' a = ans = q = [ ], t = q + 3*a' q = t =
5 6.6 Arithmetic on Vectors: Vectors may be operated by the standard operators +, -, * and Addition and Subtraction a=[ ], b=[ ], d=a+b, e=a-b a = b = d = e = Multiplication: The symbol * denotes multiplication of matrices. The operation is defined whenever the inner dimensions of the two operands are the same. Note we can not multiply the vector a by vector b directly. This is because they both have the same dimension of (5,1). For the multiplication to be possible the dimension of vector b need to change to (1,5). We can do this by transposing the vector b by using the symbol " ' ". f=a*b' Division: g=a/b Arithmetic on Arrays The term array operation refers to element -by-element arithmetic operations, instead of the usual linear algebraic matrix operation. A period (.) preceding an operator indicates an array or element-by-element operation. Addition and Subtraction: Are the same as the matrix operation. Multiplication and Division: The symbol.* denotes array, or element-by element, multiplication. If A and B have the same dimension, then A.*B denotes the array whose array are simply the product of individual elements of A and B For example: A = [1 2 3], B=[4 5 6], z= A.*B A = B = z = Or Z = A./B Results in Z = Matrix Example: 2 x 2 matrix A A = [1 2; 3 4] A = Addressing matrix elements Matrix elements are referred to with the subscript notation. If A is a matrix, then A(2,3) is the element in the second row and third column. Example: 3x3 matrix A = [1 2 3; 4 5 6; 7 8 9] A = A(2,3) % ask MATLAB to print the (2,3) element ans = 6 A(3,2) = -5 % reassign the (2,3) element A = The ones function
6 Creates a matrix whose elements are all ones. Typing ones(m,n) creates an m row by n column matrix of ones. To create a ones matrix that is the same size as an existing matric, you can use ones(size(x)). This does not affect the input argument. For example: x = [ ; ] x = y = ones(size(x)) y = The zeros function: Typing zeros(m,n) creates an m-by-n matrix of zeros, and zeros(size(x)) will create a two-byfour matrix of zeros, if x is defined the same way as above. 7.4 The max and min functions: Return the largest and smallest values in a vector. For example (this definition of z applies to the following series of examples): z = [ ] z = max(z) ans = sum and prod functions If z is a vector, sum(z) is the sum of all the elements of the vector z: sum(z) ans = -11 Similarly, prod(z) is the product of all the elements of z. prod(z) ans = Complex Numbers In Matlab complex number is indicated by the special function "i" and "j". For example z = 3 + 4i or z = 3 + 4j x = [4+5i 2 4; 1 3+i 7] x = i i Creating Strings Matrices with character elements are known as strings, where the normal rules of assignment and variable creation apply. Example: how to create string variables. first = 'John'; last = 'Coltrane'; name = [first,' ',last] The first two lines define two string variables, whereas the last line creates a new string variable from three other strings. 10 Editor and M-Files These are the program files in MATLAB used to develop meaningful programs which encompasses all the necessary code for a particular application. Up to now you were using the Matlab in its real time operation mode. That is as you entered the commands, they were executed immediately and you could observe the results. In this mode if you leave the Matlab you will loose all your instructions.
7 If the process requires many different operations, they are typed in a file using an Editor. Then the file can be saved and modified as required. The matlab files all have the extension.m. For example: miniproject.m. A simple editor is NOTEPAD editor. To use it, from Matlab screen, Click on File, then NEW, and then select M-FILE. A blank file will appear in front of you. Try the following and verify z. x=5; y=2 z=x*y Save the file as temp.m. Exit the NOTEPAd Editor to go back to Matlab Command Window. Type in: temp {followed by return} This will execute the instruction in the file temp.m. If the operation is successful you should see the value of z=10, printed on the screen. Of course you could go back and modify your file, save and then execute the file again. 11 In-built Functions MATLAB has many library functions e.g. sin, tan, cos. These functions take, in addition to scalar parameters, vectors and matrices as well. For more information see the attached document on Matlab Plotting Plotting is a simple task using the plot function plot() and will automatically plot the elements of a vector e.g. plot(v) by default the indepent axis uses the vector index number Help Facility A HELP facility provides online information for most Matlab topics. The command help with no arguments displays a list of directories that contains Matlab related files. For a list of functions covered by a particular directory, type help followed by the directory name or followed by a function name. For example: help filter List all the matrix functions relevant to generating digital filter. help plot Describes how plotting is done in Matlab Saving the Workspace File Saving: You can save the workspace by typing "save". In the NOTEPAD Editor there is a save command which can be used to save files. The save command saves all variables in a file on disk named matlab.mat. Save Temp: You can save only selected variable. The command save temp stores the current variables in the file name tem.mat. For example: save temp x saves only variable x, while save temp x y z saves x, y and z Control Structures (Loop and Conditional Statements) The "For" commands: This allows a command or series of commands to be executed several times. Similar to the for function in C. Caution: Do not to use the variable i for an index; else, you may inadvertantly redefine sqrt(-1). For example, typing for x = 1:5 x The Matlab would return: x = 1 x = 2 x = 3 x = 4 x = 5 Nested for loops: Every for command must have a matching statement. Example: for m = 1:3 for n = 1:3
8 x (m,n) = m + n*i; Matlab defines x to be the matrix: x = i i i i i i i i i The "If" command Allows you to have programs that make decisions about what commands to execute. Example: if a > 0 x = a^2; This command assigns x to be the value of "a" squared, if a is positive. Note: It must with to indicate which commands are actually part of the if. In addition, one can define an else clause, which is executed if the condition given for the if is not true. Example: if a > 0 x = a^2; else x = - a^2; For this version, if you had already set a to be 2, then x would get the value 4, but if a was -3, x would be -9. Note: only one (after all the clauses of the if) is required. The if can be expanded to include several possible conditions. If the first condition isn't satisfied, it looks for the next, and so on, until it either finds an else, or finds the. Example: if a > 0 x = a^2; elseif a == 0, x = i; else x = - a^2; Here a is checked to see if it is positive: if not, it is then checks to see whether it is zero; if a is not zero, it does the else clause. Thus, if a is positive, x well be a squared, if a is 0, x will be i, and if a is negative, then x will be the negative of a squared The "while" command It allows execution of a group of commands until some condition is no longer true. These commands appear between the while and its matching statement. Example: We want to start x at 2 and keep squaring it until it is greater than one million. x = 2 while x < x = x^2; It runs until x is e+09. Everything between the while line and the is executed until the boolean condition on the while line is no longer true. One needs to ensure that this condition will eventually stop being true, or the command will never finish. If it is not initially true, no commands will be executed The "pause" and "keyboard" commands The pause command causes MATLAB to wait for a key to be pressed before continuing.
9 The keyboard command passes control to the keyboard, indicated by the prompt K. You can examine or change variables, or issue any MATLAB command. Terminate keyboard mode by executing the command return at the K prompt. The break command be used to jump out of a for or while command earlier than expected. Example: Rewrite the while example as: while 1 if x > break; x = x^2; 12 Logical Functions True or false in Matlab are presented as: True = 1, false = 0. The following logical tests may be taken on a particular variable, function etc.: x == 2 is x equal to 2? x ~= 2 is x not equal to 2? x > 2 is x greater than 2? x < 2 is x less than 2? x >= 2 is x greater than or equal to 2? x <= 2 is x less than or equal to 2? x=pi x = x~=3, x~=pi ans = 1 ans = Masking out t = 0:0.05:6; v = sin(pi*t); x = (v >=0) w= x.*v; plot(t,v, '+', t,w,'*'); Tutorials For the following tutorial you may use the NOTEPAD Editor. You need to save the file in Matlab directory. Example 1 Plot two cycles of a sin wave at a frequency of 1 khz, for the following resolutions (a) 100 points / cycle, (b) 50 points/ cycle, and (c) 10 points / cycle Solution: Type in the following Matlab codes and save it (with a name such as " example1.m ") to your own Matlab work directory. % Name: % Date: % Filename: example1.m clear % free/clear memory close all % close all the previous graphs % Variables initialisation f=1000; % 1 khz frequency res=100; % resolution of 100 points tc=1/f; % time for one cycle of sine wave nc=2; % Number of cycles to plot dt=tc/res; % Step size, also known as the sampling frequency /Variables initialisation
10 t=0:dt:nc*tc; % time vector start from 0 and step up by step-size "dt" to tc (2 cycles). y=sin(2*pi*f*t); % sine wave for 2 cycles. The amplitude by default is 1, unless is multiply by a magnitude plot(t,y) % plot 2 cycles of "sine-wave" against the time "t" title ('1 khz sinewave') xlabel('time (s)'), % labelling the time (or x-axis) ylabel('amplitude (v)') % labelling the time (or y-axis) Example 2 Add further codes to the example 1 and save the file as example2.m. Plot sine wave against time, radian and degree Solution: % Filename: example2.m % Variables initialisation w=2*pi*f; % radian per second dg=0:360/res:nc*360; % x-axis in degree ra=t*w; % x-axis in radian y=sin(w*t); % sine wave for 2 cycles. The amplitude by default is set to 1. subplot(3,1,1), % breaks the Figure window into an m-by-n matrix of small axes. For more information use the help command (help subplot) plot(t,y) % plot the 2 cycles sine_wave against time xlabel('time (S)'), ylabel('amplitude (V)') subplot(3,1,2), plot(ra,y) % plot the 2 cycles sine wave against radian leg ('1 khz sinewave') % Puts a leg on the figure xlabel('radian'), ylabel('amplitude (V)') axis([0 4*pi -1 1]) subplot(3,1,3), plot(dg,y) % plot the 2 cycles sine_wave against degree xlabel('degree (o)'), ylabel('amplitude (V)'), axis([0 nc* ]) Example 3 Add further codes to the of example2.m file and save it as example3.m. Plot sine wave from 90 degree to 450 degree,. Solution: figure % opens a new graph start_point=find(dg==90); %look for the index where the 90 is located in the matrix/vector degree stop_point=find(dg==450); %look for the index where the 450 is located in the matrix/vector degree plot(dg(start_point:stop_point),y(start_point:stop_point)) axis([ ]) Example 4: Using loops Draw graphs of sin (nπt) on the interval -1< t < 1, for n = 1, 2, 8. Solution: t = -1: 0.05: 1; for n = 1: 8 subplot (4, 2,n) plot (t, sin(n*pi*t)) Professor Z Ghassemlooy May 2003
Matlab Introduction. Scalar Variables and Arithmetic Operators
Matlab Introduction Matlab is both a powerful computational environment and a programming language that easily handles matrix and complex arithmetic. It is a large software package that has many advanced
More informationIntroduction to Octave/Matlab. Deployment of Telecommunication Infrastructures
Introduction to Octave/Matlab Deployment of Telecommunication Infrastructures 1 What is Octave? Software for numerical computations and graphics Particularly designed for matrix computations Solving equations,
More informationLaboratory 1 Octave Tutorial
Signals, Spectra and Signal Processing Laboratory 1 Octave Tutorial 1.1 Introduction The purpose of this lab 1 is to become familiar with the GNU Octave 2 software environment. 1.2 Octave Review All laboratory
More informationOUTLINES. Variable names in MATLAB. Matrices, Vectors and Scalar. Entering a vector Colon operator ( : ) Mathematical operations on vectors.
1 LECTURE 3 OUTLINES Variable names in MATLAB Examples Matrices, Vectors and Scalar Scalar Vectors Entering a vector Colon operator ( : ) Mathematical operations on vectors examples 2 VARIABLE NAMES IN
More informationIntroduction to Matlab. By: Dr. Maher O. EL-Ghossain
Introduction to Matlab By: Dr. Maher O. EL-Ghossain Outline: q What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display Facilities Flow Control
More informationExperiment 1: Introduction to MATLAB I. Introduction. 1.1 Objectives and Expectations: 1.2 What is MATLAB?
Experiment 1: Introduction to MATLAB I Introduction MATLAB, which stands for Matrix Laboratory, is a very powerful program for performing numerical and symbolic calculations, and is widely used in science
More informationA/D Converter. Sampling. Figure 1.1: Block Diagram of a DSP System
CHAPTER 1 INTRODUCTION Digital signal processing (DSP) technology has expanded at a rapid rate to include such diverse applications as CDs, DVDs, MP3 players, ipods, digital cameras, digital light processing
More informationPART 1 PROGRAMMING WITH MATHLAB
PART 1 PROGRAMMING WITH MATHLAB Presenter: Dr. Zalilah Sharer 2018 School of Chemical and Energy Engineering Universiti Teknologi Malaysia 23 September 2018 Programming with MATHLAB MATLAB Environment
More informationIntroduction to MatLab. Introduction to MatLab K. Craig 1
Introduction to MatLab Introduction to MatLab K. Craig 1 MatLab Introduction MatLab and the MatLab Environment Numerical Calculations Basic Plotting and Graphics Matrix Computations and Solving Equations
More informationIntroduction to Engineering gii
25.108 Introduction to Engineering gii Dr. Jay Weitzen Lecture Notes I: Introduction to Matlab from Gilat Book MATLAB - Lecture # 1 Starting with MATLAB / Chapter 1 Topics Covered: 1. Introduction. 2.
More informationMATLAB Lesson I. Chiara Lelli. October 2, Politecnico di Milano
MATLAB Lesson I Chiara Lelli Politecnico di Milano October 2, 2012 MATLAB MATLAB (MATrix LABoratory) is an interactive software system for: scientific computing statistical analysis vector and matrix computations
More informationIntroduction to MATLAB
ELG 3125 - Lab 1 Introduction to MATLAB TA: Chao Wang (cwang103@site.uottawa.ca) 2008 Fall ELG 3125 Signal and System Analysis P. 1 Do You Speak MATLAB? MATLAB - The Language of Technical Computing ELG
More informationIntroduction to MATLAB
to MATLAB Spring 2019 to MATLAB Spring 2019 1 / 39 The Basics What is MATLAB? MATLAB Short for Matrix Laboratory matrix data structures are at the heart of programming in MATLAB We will consider arrays
More informationInlichtingenblad, matlab- en simulink handleiding en practicumopgaven IWS
Inlichtingenblad, matlab- en simulink handleiding en practicumopgaven IWS 1 6 3 Matlab 3.1 Fundamentals Matlab. The name Matlab stands for matrix laboratory. Main principle. Matlab works with rectangular
More informationMATLAB Basics. Configure a MATLAB Package 6/7/2017. Stanley Liang, PhD York University. Get a MATLAB Student License on Matworks
MATLAB Basics Stanley Liang, PhD York University Configure a MATLAB Package Get a MATLAB Student License on Matworks Visit MathWorks at https://www.mathworks.com/ It is recommended signing up with a student
More informationIntroduction to Matlab. Summer School CEA-EDF-INRIA 2011 of Numerical Analysis
Introduction to Matlab 1 Outline What is Matlab? Matlab desktop & interface Scalar variables Vectors and matrices Exercise 1 Booleans Control structures File organization User defined functions Exercise
More information2.0 MATLAB Fundamentals
2.0 MATLAB Fundamentals 2.1 INTRODUCTION MATLAB is a computer program for computing scientific and engineering problems that can be expressed in mathematical form. The name MATLAB stands for MATrix LABoratory,
More informationIntroduction to MATLAB
CHEE MATLAB Tutorial Introduction to MATLAB Introduction In this tutorial, you will learn how to enter matrices and perform some matrix operations using MATLAB. MATLAB is an interactive program for numerical
More informationCreates a 1 X 1 matrix (scalar) with a value of 1 in the column 1, row 1 position and prints the matrix aaa in the command window.
EE 350L: Signals and Transforms Lab Spring 2007 Lab #1 - Introduction to MATLAB Lab Handout Matlab Software: Matlab will be the analytical tool used in the signals lab. The laboratory has network licenses
More informationA Guide to Using Some Basic MATLAB Functions
A Guide to Using Some Basic MATLAB Functions UNC Charlotte Robert W. Cox This document provides a brief overview of some of the essential MATLAB functionality. More thorough descriptions are available
More informationThe value of f(t) at t = 0 is the first element of the vector and is obtained by
MATLAB Tutorial This tutorial will give an overview of MATLAB commands and functions that you will need in ECE 366. 1. Getting Started: Your first job is to make a directory to save your work in. Unix
More informationHow to learn MATLAB? Some predefined variables
ECE-S352 Lab 1 MATLAB Tutorial How to learn MATLAB? 1. MATLAB comes with good tutorial and detailed documents. a) Select MATLAB help from the MATLAB Help menu to open the help window. Follow MATLAB s Getting
More informationEE 301 Signals & Systems I MATLAB Tutorial with Questions
EE 301 Signals & Systems I MATLAB Tutorial with Questions Under the content of the course EE-301, this semester, some MATLAB questions will be assigned in addition to the usual theoretical questions. This
More informationIntroduction to MATLAB Programming
Introduction to MATLAB Programming Arun A. Balakrishnan Asst. Professor Dept. of AE&I, RSET Overview 1 Overview 2 Introduction 3 Getting Started 4 Basics of Programming Overview 1 Overview 2 Introduction
More informationChapter 1 Introduction to MATLAB
Chapter 1 Introduction to MATLAB 1.1 What is MATLAB? MATLAB = MATrix LABoratory, the language of technical computing, modeling and simulation, data analysis and processing, visualization and graphics,
More informationMATLAB Project: Getting Started with MATLAB
Name Purpose: To learn to create matrices and use various MATLAB commands for reference later MATLAB functions used: [ ] : ; + - * ^, size, help, format, eye, zeros, ones, diag, rand, round, cos, sin,
More informationELEC4042 Signal Processing 2 MATLAB Review (prepared by A/Prof Ambikairajah)
Introduction ELEC4042 Signal Processing 2 MATLAB Review (prepared by A/Prof Ambikairajah) MATLAB is a powerful mathematical language that is used in most engineering companies today. Its strength lies
More information1 Overview of the standard Matlab syntax
1 Overview of the standard Matlab syntax Matlab is based on computations with matrices. All variables are matrices. Matrices are indexed from 1 (and NOT from 0 as in C!). Avoid using variable names i and
More informationDr Richard Greenaway
SCHOOL OF PHYSICS, ASTRONOMY & MATHEMATICS 4PAM1008 MATLAB 2 Basic MATLAB Operation Dr Richard Greenaway 2 Basic MATLAB Operation 2.1 Overview 2.1.1 The Command Line In this Workshop you will learn how
More informationEGR 111 Introduction to MATLAB
EGR 111 Introduction to MATLAB This lab introduces the MATLAB help facility, shows how MATLAB TM, which stands for MATrix LABoratory, can be used as an advanced calculator. This lab also introduces assignment
More informationIntroduction to MATLAB
Introduction to MATLAB The Desktop When you start MATLAB, the desktop appears, containing tools (graphical user interfaces) for managing files, variables, and applications associated with MATLAB. The following
More informationIntroduction to MATLAB
Introduction to MATLAB 1 Introduction to MATLAB A Tutorial for the Course Computational Intelligence http://www.igi.tugraz.at/lehre/ci Stefan Häusler Institute for Theoretical Computer Science Inffeldgasse
More informationMATLAB Tutorial. Digital Signal Processing. Course Details. Topics. MATLAB Environment. Introduction. Digital Signal Processing (DSP)
Digital Signal Processing Prof. Nizamettin AYDIN naydin@yildiz.edu.tr naydin@ieee.org http://www.yildiz.edu.tr/~naydin Course Details Course Code : 0113620 Course Name: Digital Signal Processing (Sayısal
More informationDr Richard Greenaway
SCHOOL OF PHYSICS, ASTRONOMY & MATHEMATICS 4PAM1008 MATLAB 3 Creating, Organising & Processing Data Dr Richard Greenaway 3 Creating, Organising & Processing Data In this Workshop the matrix type is introduced
More informationIntroduction to MATLAB
58:110 Computer-Aided Engineering Spring 2005 Introduction to MATLAB Department of Mechanical and industrial engineering January 2005 Topics Introduction Running MATLAB and MATLAB Environment Getting help
More informationMatlab Tutorial. Get familiar with MATLAB by using tutorials and demos found in MATLAB. You can click Start MATLAB Demos to start the help screen.
University of Illinois at Urbana-Champaign Department of Electrical and Computer Engineering ECE 298JA Fall 2015 Matlab Tutorial 1 Overview The goal of this tutorial is to help you get familiar with MATLAB
More informationGetting started with MATLAB
Sapienza University of Rome Department of economics and law Advanced Monetary Theory and Policy EPOS 2013/14 Getting started with MATLAB Giovanni Di Bartolomeo giovanni.dibartolomeo@uniroma1.it Outline
More informationLecturer: Keyvan Dehmamy
MATLAB Tutorial Lecturer: Keyvan Dehmamy 1 Topics Introduction Running MATLAB and MATLAB Environment Getting help Variables Vectors, Matrices, and linear Algebra Mathematical Functions and Applications
More informationMcTutorial: A MATLAB Tutorial
McGill University School of Computer Science Sable Research Group McTutorial: A MATLAB Tutorial Lei Lopez Last updated: August 2014 w w w. s a b l e. m c g i l l. c a Contents 1 MATLAB BASICS 3 1.1 MATLAB
More informationInteractive Computing with Matlab. Gerald W. Recktenwald Department of Mechanical Engineering Portland State University
Interactive Computing with Matlab Gerald W. Recktenwald Department of Mechanical Engineering Portland State University gerry@me.pdx.edu Starting Matlab Double click on the Matlab icon, or on unix systems
More informationSome elements for Matlab programming
Some elements for Matlab programming Nathalie Thomas 2018 2019 Matlab, which stands for the abbreviation of MATrix LABoratory, is one of the most popular language for scientic computation. The classical
More informationMatlab is a tool to make our life easier. Keep that in mind. The best way to learn Matlab is through examples, at the computer.
Learn by doing! The purpose of this tutorial is to provide an introduction to Matlab, a powerful software package that performs numeric computations. The examples should be run as the tutorial is followed.
More informationFinding, Starting and Using Matlab
Variables and Arrays Finding, Starting and Using Matlab CSC March 6 &, 9 Array: A collection of data values organized into rows and columns, and known by a single name. arr(,) Row Row Row Row 4 Col Col
More informationPowerPoints organized by Dr. Michael R. Gustafson II, Duke University
Part 1 Chapter 2 MATLAB Fundamentals PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
More informationDigital Image Analysis and Processing CPE
Digital Image Analysis and Processing CPE 0907544 Matlab Tutorial Dr. Iyad Jafar Outline Matlab Environment Matlab as Calculator Common Mathematical Functions Defining Vectors and Arrays Addressing Vectors
More informationA very brief Matlab introduction
A very brief Matlab introduction Siniša Krajnović January 24, 2006 This is a very brief introduction to Matlab and its purpose is only to introduce students of the CFD course into Matlab. After reading
More informationConstraint-based Metabolic Reconstructions & Analysis H. Scott Hinton. Matlab Tutorial. Lesson: Matlab Tutorial
1 Matlab Tutorial 2 Lecture Learning Objectives Each student should be able to: Describe the Matlab desktop Explain the basic use of Matlab variables Explain the basic use of Matlab scripts Explain the
More informationLecture 2: Variables, Vectors and Matrices in MATLAB
Lecture 2: Variables, Vectors and Matrices in MATLAB Dr. Mohammed Hawa Electrical Engineering Department University of Jordan EE201: Computer Applications. See Textbook Chapter 1 and Chapter 2. Variables
More informationIntroduction to MATLAB
Introduction to MATLAB Introduction MATLAB is an interactive package for numerical analysis, matrix computation, control system design, and linear system analysis and design available on most CAEN platforms
More informationChapter 2. MATLAB Fundamentals
Chapter 2. MATLAB Fundamentals Choi Hae Jin Chapter Objectives q Learning how real and complex numbers are assigned to variables. q Learning how vectors and matrices are assigned values using simple assignment,
More informationUniversity of Alberta
A Brief Introduction to MATLAB University of Alberta M.G. Lipsett 2008 MATLAB is an interactive program for numerical computation and data visualization, used extensively by engineers for analysis of systems.
More informationMATLAB Project: Getting Started with MATLAB
Name Purpose: To learn to create matrices and use various MATLAB commands for reference later MATLAB built-in functions used: [ ] : ; + - * ^, size, help, format, eye, zeros, ones, diag, rand, round, cos,
More informationMATLAB Tutorial. Mohammad Motamed 1. August 28, generates a 3 3 matrix.
MATLAB Tutorial 1 1 Department of Mathematics and Statistics, The University of New Mexico, Albuquerque, NM 87131 August 28, 2016 Contents: 1. Scalars, Vectors, Matrices... 1 2. Built-in variables, functions,
More informationMATH (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab
MATH 495.3 (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab Below is a screen similar to what you should see when you open Matlab. The command window is the large box to the right containing the
More informationECE Lesson Plan - Class 1 Fall, 2001
ECE 201 - Lesson Plan - Class 1 Fall, 2001 Software Development Philosophy Matrix-based numeric computation - MATrix LABoratory High-level programming language - Programming data type specification not
More informationMATLAB Tutorial Matrices & Vectors MATRICES AND VECTORS
MATRICES AND VECTORS A matrix (m x n) with m rows and n columns, a column vector (m x 1) with m rows and 1 column, and a row vector (1 x m) with 1 row and m columns all can be used in MATLAB. Matrices
More informationINTRODUCTION TO MATLAB
1 of 18 BEFORE YOU BEGIN PREREQUISITE LABS None EXPECTED KNOWLEDGE Algebra and fundamentals of linear algebra. EQUIPMENT None MATERIALS None OBJECTIVES INTRODUCTION TO MATLAB After completing this lab
More informationOne-dimensional Array
One-dimensional Array ELEC 206 Prof. Siripong Potisuk 1 Defining 1-D Array Also known as a vector A list of numbers arranged in a row row vector or a column column vector A scalar variable is a one-element
More informationComputer Project: Getting Started with MATLAB
Computer Project: Getting Started with MATLAB Name Purpose: To learn to create matrices and use various MATLAB commands. Examples here can be useful for reference later. MATLAB functions: [ ] : ; + - *
More informationFreeMat Tutorial. 3x + 4y 2z = 5 2x 5y + z = 8 x x + 3y = -1 xx
1 of 9 FreeMat Tutorial FreeMat is a general purpose matrix calculator. It allows you to enter matrices and then perform operations on them in the same way you would write the operations on paper. This
More informationMATLAB BASICS. < Any system: Enter quit at Matlab prompt < PC/Windows: Close command window < To interrupt execution: Enter Ctrl-c.
MATLAB BASICS Starting Matlab < PC: Desktop icon or Start menu item < UNIX: Enter matlab at operating system prompt < Others: Might need to execute from a menu somewhere Entering Matlab commands < Matlab
More informationIntroduction to MATLAB for Engineers, Third Edition
PowerPoint to accompany Introduction to MATLAB for Engineers, Third Edition William J. Palm III Chapter 2 Numeric, Cell, and Structure Arrays Copyright 2010. The McGraw-Hill Companies, Inc. This work is
More informationIntroduction to MATLAB
Chapter 1 Introduction to MATLAB 1.1 Software Philosophy Matrix-based numeric computation MATrix LABoratory built-in support for standard matrix and vector operations High-level programming language Programming
More informationMATLAB: The Basics. Dmitry Adamskiy 9 November 2011
MATLAB: The Basics Dmitry Adamskiy adamskiy@cs.rhul.ac.uk 9 November 2011 1 Starting Up MATLAB Windows users: Start up MATLAB by double clicking on the MATLAB icon. Unix/Linux users: Start up by typing
More informationLAB 1: Introduction to MATLAB Summer 2011
University of Illinois at Urbana-Champaign Department of Electrical and Computer Engineering ECE 311: Digital Signal Processing Lab Chandra Radhakrishnan Peter Kairouz LAB 1: Introduction to MATLAB Summer
More informationMATLAB BASICS. Macro II. February 25, T.A.: Lucila Berniell. Macro II (PhD - uc3m) MatLab Basics 02/25/ / 15
MATLAB BASICS Macro II T.A.: Lucila Berniell February 25, 2010 Macro II (PhD - uc3m) MatLab Basics 02/25/2010 1 / 15 MATLAB windows Macro II (PhD - uc3m) MatLab Basics 02/25/2010 2 / 15 Numbers, vectors
More informationEric W. Hansen. The basic data type is a matrix This is the basic paradigm for computation with MATLAB, and the key to its power. Here s an example:
Using MATLAB for Stochastic Simulation. Eric W. Hansen. Matlab Basics Introduction MATLAB (MATrix LABoratory) is a software package designed for efficient, reliable numerical computing. Using MATLAB greatly
More informationECON 502 INTRODUCTION TO MATLAB Nov 9, 2007 TA: Murat Koyuncu
ECON 502 INTRODUCTION TO MATLAB Nov 9, 2007 TA: Murat Koyuncu 0. What is MATLAB? 1 MATLAB stands for matrix laboratory and is one of the most popular software for numerical computation. MATLAB s basic
More informationMATLAB TUTORIAL WORKSHEET
MATLAB TUTORIAL WORKSHEET What is MATLAB? Software package used for computation High-level programming language with easy to use interactive environment Access MATLAB at Tufts here: https://it.tufts.edu/sw-matlabstudent
More informationELEN E3084: Signals and Systems Lab Lab II: Introduction to Matlab (Part II) and Elementary Signals
ELEN E384: Signals and Systems Lab Lab II: Introduction to Matlab (Part II) and Elementary Signals 1 Introduction In the last lab you learn the basics of MATLAB, and had a brief introduction on how vectors
More information1 Introduction to Matlab
1 Introduction to Matlab 1. What is Matlab? Matlab is a computer program designed to do mathematics. You might think of it as a super-calculator. That is, once Matlab has been started, you can enter computations,
More informationIntroduction to MATLAB 7 for Engineers
PowerPoint to accompany Introduction to MATLAB 7 for Engineers William J. Palm III Chapter 2 Numeric, Cell, and Structure Arrays Copyright 2005. The McGraw-Hill Companies, Inc. Permission required for
More informationMATLAB Fundamentals. Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University
MATLAB Fundamentals Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University Reference: 1. Applied Numerical Methods with MATLAB for Engineers, Chapter 2 &
More informationPC-MATLAB PRIMER. This is intended as a guided tour through PCMATLAB. Type as you go and watch what happens.
PC-MATLAB PRIMER This is intended as a guided tour through PCMATLAB. Type as you go and watch what happens. >> 2*3 ans = 6 PCMATLAB uses several lines for the answer, but I ve edited this to save space.
More informationMATLAB COURSE FALL 2004 SESSION 1 GETTING STARTED. Christian Daude 1
MATLAB COURSE FALL 2004 SESSION 1 GETTING STARTED Christian Daude 1 Introduction MATLAB is a software package designed to handle a broad range of mathematical needs one may encounter when doing scientific
More informationMAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB
MAT 343 Laboratory 1 Matrix and Vector Computations in 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
More informationIntroduction to. The Help System. Variable and Memory Management. Matrices Generation. Interactive Calculations. Vectors and Matrices
Introduction to Interactive Calculations Matlab is interactive, no need to declare variables >> 2+3*4/2 >> V = 50 >> V + 2 >> V Ans = 52 >> a=5e-3; b=1; a+b Most elementary functions and constants are
More informationMATLAB Basics EE107: COMMUNICATION SYSTEMS HUSSAIN ELKOTBY
MATLAB Basics EE107: COMMUNICATION SYSTEMS HUSSAIN ELKOTBY What is MATLAB? MATLAB (MATrix LABoratory) developed by The Mathworks, Inc. (http://www.mathworks.com) Key Features: High-level language for numerical
More informationA 30 Minute Introduction to Octave ENGR Engineering Mathematics Tony Richardson
A 30 Minute Introduction to Octave ENGR 390 - Engineering Mathematics Tony Richardson Introduction This is a brief introduction to Octave. It covers several topics related to both the statistics and linear
More informationA = [1, 6; 78, 9] Note: everything is case-sensitive, so a and A are different. One enters the above matrix as
1 Matlab Primer The purpose of these notes is a step-by-step guide to solving simple optimization and root-finding problems in Matlab To begin, the basic object in Matlab is an array; in two dimensions,
More informationPhysics 326G Winter Class 2. In this class you will learn how to define and work with arrays or vectors.
Physics 326G Winter 2008 Class 2 In this class you will learn how to define and work with arrays or vectors. Matlab is designed to work with arrays. An array is a list of numbers (or other things) arranged
More informationIntroduction to MATLAB Practical 1
Introduction to MATLAB Practical 1 Daniel Carrera November 2016 1 Introduction I believe that the best way to learn Matlab is hands on, and I tried to design this practical that way. I assume no prior
More informationThis is a basic tutorial for the MATLAB program which is a high-performance language for technical computing for platforms:
Appendix A Basic MATLAB Tutorial Extracted from: http://www1.gantep.edu.tr/ bingul/ep375 http://www.mathworks.com/products/matlab A.1 Introduction This is a basic tutorial for the MATLAB program which
More informationLAB 1 General MATLAB Information 1
LAB 1 General MATLAB Information 1 General: To enter a matrix: > type the entries between square brackets, [...] > enter it by rows with elements separated by a space or comma > rows are terminated by
More informationMatlab Tutorial. The value assigned to a variable can be checked by simply typing in the variable name:
1 Matlab Tutorial 1- What is Matlab? Matlab is a powerful tool for almost any kind of mathematical application. It enables one to develop programs with a high degree of functionality. The user can write
More informationEE3TP4: Signals and Systems Lab 1: Introduction to Matlab Tim Davidson Ext Objective. Report. Introduction to Matlab
EE3TP4: Signals and Systems Lab 1: Introduction to Matlab Tim Davidson Ext. 27352 davidson@mcmaster.ca Objective To help you familiarize yourselves with Matlab as a computation and visualization tool in
More informationSF1901 Probability Theory and Statistics: Autumn 2016 Lab 0 for TCOMK
Mathematical Statistics SF1901 Probability Theory and Statistics: Autumn 2016 Lab 0 for TCOMK 1 Preparation This computer exercise is a bit different from the other two, and has some overlap with computer
More informationA General Introduction to Matlab
Master Degree Course in ELECTRONICS ENGINEERING http://www.dii.unimore.it/~lbiagiotti/systemscontroltheory.html A General Introduction to Matlab e-mail: luigi.biagiotti@unimore.it http://www.dii.unimore.it/~lbiagiotti
More informationIntroduction to Matlab
Introduction to Matlab 1 Outline: What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display Facilities Flow Control Using of M-File Writing User
More informationMATLAB/Octave Tutorial
University of Illinois at Urbana-Champaign Department of Electrical and Computer Engineering ECE 298JA Fall 2017 MATLAB/Octave Tutorial 1 Overview The goal of this tutorial is to help you get familiar
More informationChapter 7: Programming in MATLAB
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Computer Programming (ECIV 2302) Chapter 7: Programming in MATLAB 1 7.1 Relational and Logical Operators == Equal to ~=
More informationWhat is MATLAB and howtostart it up?
MAT rix LABoratory What is MATLAB and howtostart it up? Object-oriented high-level interactive software package for scientific and engineering numerical computations Enables easy manipulation of matrix
More informationMATLAB Vocabulary. Gerald Recktenwald. Version 0.965, 25 February 2017
MATLAB Vocabulary Gerald Recktenwald Version 0.965, 25 February 2017 MATLAB is a software application for scientific computing developed by the Mathworks. MATLAB runs on Windows, Macintosh and Unix operating
More informationColorado State University Department of Mechanical Engineering. MECH Laboratory Exercise #1 Introduction to MATLAB
Colorado State University Department of Mechanical Engineering MECH 417 - Laboratory Exercise #1 Introduction to MATLAB Contents 1) Vectors and Matrices... 2 2) Polynomials... 3 3) Plotting and Printing...
More informationIntroduction to Matlab
Introduction to Matlab By:Mohammad Sadeghi *Dr. Sajid Gul Khawaja Slides has been used partially to prepare this presentation Outline: What is Matlab? Matlab Screen Basic functions Variables, matrix, indexing
More informationOutline. CSE 1570 Interacting with MATLAB. Starting MATLAB. Outline (Cont d) MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An
CSE 170 Interacting with MATLAB Instructor: Aijun An Department of Computer Science and Engineering York University aan@cse.yorku.ca Outline Starting MATLAB MATLAB Windows Using the Command Window Some
More informationOutline. CSE 1570 Interacting with MATLAB. Starting MATLAB. Outline. MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An.
CSE 170 Interacting with MATLAB Instructor: Aijun An Department of Computer Science and Engineering York University aan@cse.yorku.ca Outline Starting MATLAB MATLAB Windows Using the Command Window Some
More informationIntroduction to Matlab. By: Hossein Hamooni Fall 2014
Introduction to Matlab By: Hossein Hamooni Fall 2014 Why Matlab? Data analytics task Large data processing Multi-platform, Multi Format data importing Graphing Modeling Lots of built-in functions for rapid
More informationUNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER
UNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER BENC 2113 DENC ECADD 2532 ECADD LAB SESSION 6/7 LAB
More informationCME 192: Introduction to Matlab
CME 192: Introduction to Matlab Matlab Basics Brett Naul January 15, 2015 Recap Using the command window interactively Variables: Assignment, Identifier rules, Workspace, command who and whos Setting the
More information