A Very Brief Introduction to Matlab

Size: px
Start display at page:

Download "A Very Brief Introduction to Matlab"

Transcription

1 A Very Brief Introduction to Matlab by John MacLaren Walsh, Ph.D. for ECES 63 Fall 26 October 3, 26 Introduction To MATLAB You can type normal mathematical operations into MATLAB as you would in an electronic calculator. Begin by typing +3 [Enter], you should see EDU>> +3 Your display may not include the EDU before the prompt. This just indicates that you are using a version other than the student version of MATLAB. Other mathematical operations are just as simple as addition. For example, here s how to subtract two numbers EDU>> -2 - Multiplication is naturally just as simple, as is handling non-integer numbers EDU>> 2.25*2.5 To calculate a number to an exponent use the syntax EDU>> 2^2 The syntax for other binary operations implemented in MATLAB is shown in Table. Suppose we wish to store the result of an operation so we can access it later. We can do this by assigning a variable name to the result of an operation, i.e. EDU>> r=3*5; EDU>> s=2.2; EDU>> r*s 33

2 MATLAB Expression Description x+y Add x and y. x-y Subtract y from x. x*y Multiply x and y. x/y Divide x by y. x y x to the yth power ( ) Parenthesis x= y Assign the value of y to x x == y Test to see if each elements of x and y are equal Table : Arithmetic Operations in MATLAB. Here, the variable names were r and s. Variable names consist of a letter, followed by any number of letters, digits, or underscores. MATLAB uses only the first 3 characters of a variable name. MATLAB is case sensitive; it distinguishes between uppercase and lowercase letters. A and a are not the same variable. To view the matrix assigned to any variable, simply enter the variable name. Also, you should not pick variable names that are the same as the name of a function (to be discussed later). We suppressed MATLAB s output for the first two commands by including a semicolon (;) at the end of the command. Notice also that = here works differently from the usual mathematical notion of equality, instead it acts as an assignment operator. If you want to test whether or not two items are equal, you should use ==. MATLAB will return if the two items are equal and if they are not. EDU>> s=2.2; EDU>> s==2.2 EDU>> s==33. Vectors and Matrices in MATLAB MATLAB is built to naturally work with vectors and matrices (the former are a special case of the latter with one of the two dimensions having length ). To input a column vector into MATLAB, surround the vector you wish to input with brackets, and separate its elements with semicolons: EDU>> v=[ ; 2 ; 3 ; ] v = 2 3 Row vectors are input in a similar manner, only the elements are separated by commas or spaces. EDU>> v2=[,2,3,] Quote from MATLAB documentation. 2

3 v2 = 2 3 EDU>> v2=[ 2 3 ] v2 = 2 3 Note that another way to make this same vector is EDU>> v2=[:] v2 = 2 3 The second way of creating v2 exploited an operator, :, in MATLAB that counts in increments of from its left argument to its right argument. Increments other than are also possible, one just uses a : x : b, where MATLAB will produce a row vectors whose elements count in increments of x from a to b. EDU>> v3=[:.25:2] v3 = You can concatenate two row or column vectors by using them as elements in a new row or column vector, respectively. For a column vector, imitate the following syntax. EDU>> v=[;2]; EDU>> v2=[3;;5]; EDU>> v=[v;v2] v = For a row vector, imitate the following syntax EDU>> v=[,2]; EDU>> v2=[3,,5]; EDU>> v=[v,v2] v = To enter a matrix, you just combine the ideas above. Here s an example 3

4 EDU>> A=[,2,3;,5,6] A = Note that you need to be careful that the number of rows are the same for every column, and likewise the number of columns are the same for every row in your matrix. Otherwise, MATLAB will produce an error. EDU>> A=[,2;,2,3];??? Error using ==> vertcat All rows in the bracketed expression must have the same number of columns. As another example, imagine you tried to concatenate a row vector and a column vector EDU>> v=[,2]; EDU>> v2=[3;;5]; EDU>> v=[v,v2];??? Error using ==> horzcat All matrices on a row in the bracketed expression must have the same number of rows. You can access elements within a matrix or vector by just specifying their coordinates. MATLAB uses based indexing 2. Thus, the first element in any vector, v, is denoted by v(). EDU>> v=[3,,5]; EDU>> v() 3 EDU>> v(2) EDU>> v(3) 5 You can also access multiple elements of a vector at a time. EDU>> v=[,2,3,,5]; EDU>> v(2:) 2 3 You can access elements of matrices by specifying their coordinate pairs (where the row number comes first and the column number comes second). 2 This is different from the based indexing used in C, C++, JAVA and other programming languages.

5 EDU>> A=[,2;3,] A = 2 3 EDU>> A(,) EDU>> A(2,2) EDU>> A(,2) 2 MATLAB operations are made to naturally work with matrices. Matrix addition and subtraction can be performed on any two matrices with the same dimensions EDU>> A=[,2;3,]; EDU>> B=[,;,]; EDU>> C=[,2,3;,5,6]; EDU>> A+B EDU>> A-B 2 3 EDU>> A+C??? Error using ==> plus Matrix dimensions must agree. EDU>> C-A??? Error using ==> minus Matrix dimensions must agree. Matrix multiplication uses the same syntax as the multiplication of two scalars 5

6 EDU>> A=[,2;3,;5,6] A = EDU>> B=[,3;2,]; EDU>> A*B Recall from linear algebra that matrix multiplication only makes sense when the number of columns in the left matrix matches the number of rows in the right matrix. Thus, matrix multiplication is not commutative for general matrices, and while A*B might exist, B*A might not even be defined. EDU>> B*A??? Error using ==> mtimes Inner matrix dimensions must agree. Occasionally, one wishes to multiply or divide two matrices of the same dimensions element by element, this can be done using the operator.* or./ respectively EDU>> A=[,2;3,]; EDU>> B=[,;,]; EDU>> A.*B 2 3 EDU>> B./A Check Yourself: Show how to make a row vector with elements between and evenly spaced by Controlling Program Flow in MATLAB: (if, for, etc) There are eight flow control statements in MATLAB 3 : if, together with else and elseif, executes a group of statements based on some logical condition. switch, together with case and otherwise, executes different groups of statements depending on the value of some logical condition. while executes a group of statements an indefinite number of times, based on some logical condition. 3 This section taken verbatim from the MATLAB Getting Started Documentation. 6

7 Name Description Example size returns the dimensions of a matrix argument size(a) ones Creates a m n matrix whose elements are all ones ones(m,n) zeros Creates a m n matrix whose elements are all zeros zeros(m,n) max Find the largest element in each column of a matrix max(a) min Find the smallest element in each column of a matrix min(a) help Displays help about a particular command. help size Table 2: Some MATLAB commands. Note that the help command does not place parenthesis around its arguments. for executes a group of statements a fixed number of times. continue passes control to the next iteration of a for or while loop, skipping any remaining statements in the body of the loop. break terminates execution of a for or while loop. try...catch changes flow control if an error is detected during execution. return causes execution to return to the invoking function. All flow constructs use end to indicate the end of the flow control block. You can learn more about these statements in MATLAB s help system under the heading MATLABLEARNING MATLAB FLOW CON- TROL. Get there by clicking the Help menu in the command window, then clicking on MATLAB Help, then clicking on MATLAB, then clicking on LEARNING MATLAB, then clicking on PROGRAMMING, then clicking on FLOW CONTROL..3 Using Built-in MATLAB Functions The power of MATLAB lies in the thousands of functions that come with it. Functions can take arguments and produce outputs. Arguments to the function are placed in parenthesis after the function name. For example, the size function returns the dimensions of a matrix argument EDU>> A=[,2,3;,5,6]; EDU>> size(a) 2 3 Outputs from the function can be assigned to variable names as you would assign the result of any expression. EDU>> z=size(a) z = 2 3 Note that some functions will give you more information if you ask for more output arguments. For example, the max function, which finds the largest element in a vector argument, has several options for the number of output arguments. If there is one output argument, max just returns the maximum value in the vector. If there are two output arguments, then max will return the maximum value in the first output argument and the index (i.e., its location) in the second argument. These are directions for Student Version R. If you are using an older version, search the documentation for help on flow control by clicking on the search tab, typing flow control, and clicking search. 7

8 EDU>> c=[,3,2]; EDU>> z=max(c) z = 3 EDU>> [z,i]=max(c) z = 3 i = 2 A few functions that you are certain to need are shown in Table 2. However, there are way too many functions in MATLAB that you will use to list here, so in the next section we will provide you a means for determining function names and learning how to use them. Before you start to write a program to do something, check to see if there is a MATLAB routine that already does it by using a keyword search in the documentation. Oftentimes you will find that there is already a program written to do what you need, and you just need to give it the proper parameters.. Getting Help on Functions One of the most important skills for a MATLAB user is the ability to find a MATLAB function that does what you need, and then learn how to use it. To do the former, it is often helpful to do a keyword search on the MATLAB documentation. To do this, just click on the HELP menu, and select MATLAB. Then, in the window that pops up, click on the search tab, and enter a word or phrase that describes what you wish to do. This often yields results more quickly than guessing function names. If you do not want to use the java based help documentation, you can use the command lookfor at the command prompt for this same purpose. Simply type lookfor followed by some keywords describing what you want to do. Once you know the name of the function you think will do what you need, type help followed by the function name to learn the syntax for it. For example EDU>> help size SIZE Size of array. D = SIZE(X), for M-by-N matrix X, returns the two-element row vector D = [M, N] containing the number of rows and columns in the matrix. For N-D arrays, SIZE(X) returns a -by-n vector of dimension lengths. Trailing singleton dimensions are ignored. [M,N] = SIZE(X) for matrix X, returns the number of rows and columns in X as separate output variables. [M,M2,M3,...,MN] = SIZE(X) returns the sizes of the first N dimensions of array X. If the number of output arguments N does not equal NDIMS(X), then for: N > NDIMS(X), size returns ones in the "extra" variables, i.e., outputs NDIMS(X)+ through N. N < NDIMS(X), MN contains the product of the sizes of the remaining dimensions, i.e., dimensions N+ through 8

9 NDIMS(X). M = SIZE(X,DIM) returns the length of the dimension specified by the scalar DIM. For example, SIZE(X,) returns the number of rows. When SIZE is applied to a Java array, the number of rows returned is the length of the Java array and the number of columns is always. When SIZE is applied to a Java array of arrays, the result describes only the top level array in the array of arrays. See also length, ndims, numel. Overloaded functions or methods (ones with the same name in other directories) help timer/size.m help serial/size.m help gf/size.m Reference page in Help browser doc size In the next few sections, we will familiarize you with some of the functions necessary for using MATLAB for ECES 63. Check Yourself: Find a function that sums the entries of a row vector. Show the help information for this function..5 Saving and Loading Data By now, you have probably noticed that if you assign a value to a variable name, MATLAB remembers that value until you assign the variable name a new value, or exit the program. To see which variable names MATLAB is currently remembering, you can use the command who. EDU>> clear all; EDU>> A=.5; EDU>> B=.3; EDU>> who Your variables are: A B A way to make MATLAB forget that you have assigned that variable name a value is to use the clear command. EDU>> A=.5; EDU>> A A = EDU>> clear A EDU>> A??? Undefined function or variable A. You can clear several variable names by listing them after the clear command, or, if you want to clear all of the variable names you can use clear all (as in the example above). Oftentimes, you will need to save data that you have created in MATLAB to a file on your hard disk, diskette, CD, or DVD so you can use 9

10 it at a later time. This can be done using the save and load commands. The following command saves the contents of A to a file in the current directory named savedata.mat, clears the workspace, verifies that there does not exist a variable named A anymore, then loads savedata.mat into the workspace, and verifies that the contents of A have been restored. EDU>> A=.5; EDU>> A A = EDU>> save savedata.mat A EDU>> clear all EDU>> who EDU>> load savedata.mat EDU>> who Your variables are: A EDU>> A A = Saving multiple variables is just as easy, simply list the variables that you wish to save after the filename in the save command. EDU>> save savedata.mat A B If you would rather save every variable in the workspace, then do not list any variables after the save command. EDU>> save savedata.mat Note that unless you give it another path, MATLAB saves the file in the current working directory. You can determine the current directory by typing pwd. If you wish to choose another working directory, you can use the cd command followed by the name of the directory you wish to go to. You can print the contents of the current directory using the ls command..6 Plotting and Labelling 2D and 3D Data Oftentimes you will want to plot a graph using MATLAB. MATLAB s plot command takes a vector of data for the x axis of your graph and a vector of y values representing the value of the function you wish to plot at each of these points. Let s say that you wanted to plot a single period of a sinusoid. The following commands will produce the plot shown in Figure. thetas=[-pi:pi/6:pi]; yvals=sin(thetas); plot(thetas,yvals, b- ); xlabel( \theta ); ylabel( sin(\theta) ); title( The sin Function ); The first line defines the vector of evenly spaced points in increments of π/6 between -π and π to use as the x axis in the plot. The second line evaluates the function that we wish to plot at each of these

11 The sin Function.8.2 sin(θ) θ Figure : sin(θ) for θ [ π, π]. points. The next line plots the values of the function versus the values we chose for the x axis, and the b- demands that the plotter connect these data points with a blue line. To learn about other options for the line style, type help plot. The next three lines label the graph in a self explanatory way. (Note that in general, if you wish to use a Greek letter in your plot, you can precede its English name by a backslash.) The command axis tight will remove the extra white space on either side of your plot (try it). Note also that when we plot a line in this manner, we need to choose the increments in the x-axis (pi/6 in this case) carefully, so that the graph appears smooth and the essential features are visible. Oftentimes, choosing this value is a matter of guessing and testing multiple times. Now let s suppose that you wish to plot a second line, cos(θ), on your graph. You can do this by typing hold on; plot(thetas,cos(thetas), rx- ); legend( sin(\theta), cos(\theta) ); which produces the graph shown in Figure 2. The hold on command sees to it that any new lines are drawn on top of the existing graph. If you do not use it, MATLAB will erase the previous lines and labels on the graph. Note that we used a different plot style this time, rx-, to make it easy to distinguish between the two graphs. Type help plot for more line styles. Finally, notice that we labelled the lines by using a legend. Order your labels in the legend in the same order that you plotted the graphs so that the correct label is applied to the correct line style. Note that we explored just one simple type of two dimensional plot here. MATLAB is also capable of creating a number of other specialized 2D plots. Type help graph2d and help specgraph for more information. One of these other specialized 2D plots is the stem plot, which is convenient if you have a small number of discrete time data samples you would like to plot. Type help stem for more information. Check Yourself: Create a labelled graph showing the function y = e x for x between and. Make sure your graph has a title and axis labels. You will probably find the MATLAB command exp useful for this exercise. Now suppose that you want to plot a graph describing a phenomenon where there were two independent variables instead of one. Let s imagine that you wish to plot z = exp ( (x 2 + y 2 ) ) as a function of x and y. We can do this in much the same way we created the two dimensional graph. First we create a grid of evenly spaced points in x and y (this gives us a matrix of x values and a matrix of y values). The command we will use to do this is called meshgrid. We then evaluate our function on

12 .8 The sin Function sin(θ) cos(θ).2 sin(θ) θ Figure 2: cos(θ) and sin(θ) for θ [ π, π]. this grid and call a plotting routine. There are several plotting routines to choose between. The following example investigates a mesh plot (Figure 3), a surface (Figure ), and a contour plot (Figure 5). A mesh plot is a collection of lines that look like a wire mesh that has been shaped to match a perspective of the surface you plotted. In this instance, the color of the line also shows the height of a line. A surface plot is similar to mesh plot, only now a perspective of the entire surface is drawn instead of just a grid. A contour plot is a plot in which contours in x and y corresponding to a constant value of z are shown. If you are interested in using any of these plots, be sure to read the help files for each. There are also a number of other types of 3D plots, type graph3d to get a list of commands. [xx,yy]=meshgrid([-:.5:],[-:.5:]); zz=exp(-*(xx.^2+yy.^2)); figure; mesh(xx,yy,zz); xlabel( x axis ); ylabel( y axis ); zlabel( z axis ); title( exp(-(x^2+y^2)) ); figure; surf(xx,yy,zz); xlabel( x axis ); ylabel( y axis ); zlabel( z axis ); title( exp(-(x^2+y^2)) ); figure; [c,f]=contour(xx,yy,zz); clabel(c,f); xlabel( x axis ); ylabel( y axis ); title( Contours that Yield exp(-(x^2+y^2)) Constant ); Check Yourself: Create a labelled mesh plot of the surface z = x sin(x + y) for < x < π and < y < π. 2

13 exp( (x 2 +y 2 )).8 z axis.2 y axis x axis Figure 3: A mesh plot of exp( x 2 y 2 ). exp( (x 2 +y 2 )).8 z axis.2 y axis x axis Figure : A surface perspective of exp( x 2 y 2 ). 3

14 .8.2 Contours that Yield exp( (x 2 +y 2 )) Constant y axis x axis.2 Figure 5: A contour plot of exp( x 2 y 2 )..7 Using.M files as scripts and functions Instead of entering commands line by line at the MATLAB command prompt, it is often more convenient to collect them all into a single MATLAB script. A MATLAB script is a text file filled with the MATLAB commands that you wish to execute. To create a MATLAB script file, either use the MATLAB editor or your favorite text editor to type all of your MATLAB commands, then save the file with a.m extension (for example myscript.m is a valid MATLAB script file name). You can now execute all of the commands in the file at once by typing the part of the file name before the.m (in our example this is myscript) at the MATLAB prompt. Note that you need to be in the same directory in MATLAB as the script file that you wish to execute (you can do this using the cd command as you would in a DOS shell). To test this out, cut and paste the commands in the last plotting example into a text editor (e.g., the MATLAB editor), save the file under a name with a.m extension, move MATLAB to the directory you saved it in (using the cd command) and execute it. Do you get the plots shown in the figures? Using.M files allows you to assemble all of your MATLAB code into one place so that it is one clear cohesive program. You should add comments to your code (comments are text that MATLAB ignores that people reading your code can read to help understand what your program is doing/ what you want your program to do). Comments begin with %, anything after a % is ignored by MATLAB EDU>> 2+2 % MATLAB will not read this A commented version of the last plotting example might look like %create an evenly spaced grid of points [xx,yy]=meshgrid([-:.5:],[-:.5:]); %evaluate the function to plot at these points zz=exp(-*(xx.^2+yy.^2)); figure; %open a new figure window mesh(xx,yy,zz); %create a mesh plot using the data xlabel( x axis ); %give the x axis a label ylabel( y axis ); %give the y axis a label zlabel( z axis ); %give the z axis a label

15 title( exp(-(x^2+y^2)) ); %give the graph a title figure; %open a new figure window surf(xx,yy,zz);%create a surface plot using the data xlabel( x axis ); %label the x-axis ylabel( y axis ); %label the y-axis zlabel( z axis ); %label the z-axis title( exp(-(x^2+y^2)) ); %title the graph figure; %open a new figure window [c,f]=contour(xx,yy,zz); %create a contour plot using the data clabel(c,f); %label the contours according to their zz value xlabel( x axis ); %label the x axis ylabel( y axis ); %label the y axis %give the graph a title title( Contours that Yield exp(-(x^2+y^2)) Constant ); MATLAB scripts are an efficient way of organizing code, but often one wishes to write a piece of code that one can use time and time again, only perhaps with different parameters. To do this, one can write their own MATLAB function file. Functions can both take and return parameters. Here is a function that takes a parameter x and returns x 2 function y=mynewfunction(x) % This is a function that returns its argument squared. y=x^2; You must save functions in files whose name is the same as the function name and have the.m extension. For our example, the file name must be mynewfunction.m. Try copying the function above into a file, saving it, and then execute mynewfunction(2). Do you see the following? EDU>> mynewfunction(2).8 Manipulating Audio Files Among other things, MATLAB is capable of processing audio signals, provided your computer has a sound card and speakers. If your computer is not capable of playing sound you may skip this section of the lab. In this first class on signal processing, we will use this ability to give an intuitive and interactive flavor to our experiments. MATLAB already has a few audio files ready to load. Try the following example load handel; sound(y,fs); You should hear a snippet from Handel s Hallelujah Chorus. MATLAB will also work with digital audio files saved using either a Microsoft WAVE sound file (.wav) or the NeXT/SUN (.au) format. The commands to load the data are simple and easy to use. To load a.wav file, use the command wavread and to load an.au file use the command auread. Here is an example in which a wave file is loaded and played [y,fs,nbits]=wavread( \windows\media\chimes.wav ); sound(y,fs); Check Yourself: Load the audio data in laughter.mat by typing load laughter;. Play the loaded audio..9 Where to Learn More Now that you have completed this introduction, you have learned what is necessary to use MATLAB in ECES 63. If you wish to become an advanced user, however, it is recommended that you read through the Learning MATLAB section in the MATLAB Documentation. Also, a good review of many of the ideas presented in this laboratory can be found at tutorials/intropage.html. 5

Introduction to MATLAB

Introduction 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 information

Introduction to Matlab. By: Dr. Maher O. EL-Ghossain

Introduction 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 information

Introduction to MATLAB LAB 1

Introduction to MATLAB LAB 1 Introduction to MATLAB LAB 1 1 Basics of MATLAB MATrix LABoratory A super-powerful graphing calculator Matrix based numeric computation Embedded Functions Also a programming language User defined functions

More information

1 Introduction to Matlab

1 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 information

Introduction to MATLAB

Introduction 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 information

ECE Lesson Plan - Class 1 Fall, 2001

ECE 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 information

A Guide to Using Some Basic MATLAB Functions

A 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 information

MATLAB Project: Getting Started with MATLAB

MATLAB 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 information

Getting started with MATLAB

Getting 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 information

Introduction to Matlab

Introduction 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 information

EE 301 Signals & Systems I MATLAB Tutorial with Questions

EE 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 information

EGR 111 Introduction to MATLAB

EGR 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 information

ELEC4042 Signal Processing 2 MATLAB Review (prepared by A/Prof Ambikairajah)

ELEC4042 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 information

Appendix A. Introduction to MATLAB. A.1 What Is MATLAB?

Appendix A. Introduction to MATLAB. A.1 What Is MATLAB? Appendix A Introduction to MATLAB A.1 What Is MATLAB? MATLAB is a technical computing environment developed by The Math- Works, Inc. for computation and data visualization. It is both an interactive system

More information

Introduction to MATLAB

Introduction 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 information

Matlab Tutorial and Exercises for COMP61021

Matlab Tutorial and Exercises for COMP61021 Matlab Tutorial and Exercises for COMP61021 1 Introduction This is a brief Matlab tutorial for students who have not used Matlab in their programming. Matlab programming is essential in COMP61021 as a

More information

AMS 27L LAB #2 Winter 2009

AMS 27L LAB #2 Winter 2009 AMS 27L LAB #2 Winter 2009 Plots and Matrix Algebra in MATLAB Objectives: 1. To practice basic display methods 2. To learn how to program loops 3. To learn how to write m-files 1 Vectors Matlab handles

More information

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

Creates 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 information

2.0 MATLAB Fundamentals

2.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 information

MATLAB Project: Getting Started with MATLAB

MATLAB 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 information

An Introduction to MATLAB II

An Introduction to MATLAB II Lab of COMP 319 An Introduction to MATLAB II Lab tutor : Gene Yu Zhao Mailbox: csyuzhao@comp.polyu.edu.hk or genexinvivian@gmail.com Lab 2: 16th Sep, 2013 1 Outline of Lab 2 Review of Lab 1 Matrix in Matlab

More information

Introduction to Matlab

Introduction 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 information

Matlab is a tool to make our life easier. Keep that in mind. The best way to learn Matlab is through examples, at the computer.

Matlab 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 information

Laboratory 1 Octave Tutorial

Laboratory 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 information

Finding MATLAB on CAEDM Computers

Finding MATLAB on CAEDM Computers Lab #1: Introduction to MATLAB Due Tuesday 5/7 at noon This guide is intended to help you start, set up and understand the formatting of MATLAB before beginning to code. For a detailed guide to programming

More information

MAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB

MAT 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 information

UNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER

UNIVERSITI 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 information

University of Alberta

University 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 information

Introduction to Matlab. Summer School CEA-EDF-INRIA 2011 of Numerical Analysis

Introduction 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 information

AN INTRODUCTION TO MATLAB

AN INTRODUCTION TO MATLAB 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,

More information

Computer Project: Getting Started with MATLAB

Computer 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 information

Constraint-based Metabolic Reconstructions & Analysis H. Scott Hinton. Matlab Tutorial. Lesson: Matlab Tutorial

Constraint-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 information

Introduction to MATLAB

Introduction to MATLAB Introduction to MATLAB Introduction: MATLAB is a powerful high level scripting language that is optimized for mathematical analysis, simulation, and visualization. You can interactively solve problems

More information

EE3TP4: 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 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 information

AMATH 352: MATLAB Tutorial written by Peter Blossey Department of Applied Mathematics University of Washington Seattle, WA

AMATH 352: MATLAB Tutorial written by Peter Blossey Department of Applied Mathematics University of Washington Seattle, WA AMATH 352: MATLAB Tutorial written by Peter Blossey Department of Applied Mathematics University of Washington Seattle, WA MATLAB (short for MATrix LABoratory) is a very useful piece of software for numerical

More information

Unix Computer To open MATLAB on a Unix computer, click on K-Menu >> Caedm Local Apps >> MATLAB.

Unix Computer To open MATLAB on a Unix computer, click on K-Menu >> Caedm Local Apps >> MATLAB. MATLAB Introduction This guide is intended to help you start, set up and understand the formatting of MATLAB before beginning to code. For a detailed guide to programming in MATLAB, read the MATLAB Tutorial

More information

9/24/12 5:12 PM MATLAB... 1 of 31

9/24/12 5:12 PM MATLAB... 1 of 31 9/24/12 5:12 PM MATLAB... 1 of 31 >> [ 4; 2 3 4 5; 3 4 5 6; 4 5 6 7]; >> A >> A' >> A(3,4) 4 2 3 4 5 3 4 5 6 4 5 6 7 4 2 3 4 5 3 4 5 6 4 5 6 7 6 >> A(:,2) 9/24/12 5:12 PM MATLAB... 2 of 31 2 3 4 5 >> A(3,:)

More information

Desktop Command window

Desktop Command window Chapter 1 Matlab Overview EGR1302 Desktop Command window Current Directory window Tb Tabs to toggle between Current Directory & Workspace Windows Command History window 1 Desktop Default appearance Command

More information

MATLAB Tutorial EE351M DSP. Created: Thursday Jan 25, 2007 Rayyan Jaber. Modified by: Kitaek Bae. Outline

MATLAB Tutorial EE351M DSP. Created: Thursday Jan 25, 2007 Rayyan Jaber. Modified by: Kitaek Bae. Outline MATLAB Tutorial EE351M DSP Created: Thursday Jan 25, 2007 Rayyan Jaber Modified by: Kitaek Bae Outline Part I: Introduction and Overview Part II: Matrix manipulations and common functions Part III: Plots

More information

Summer 2009 REU: Introduction to Matlab

Summer 2009 REU: Introduction to Matlab Summer 2009 REU: Introduction to Matlab Moysey Brio & Paul Dostert June 29, 2009 1 / 19 Using Matlab for the First Time Click on Matlab icon (Windows) or type >> matlab & in the terminal in Linux. Many

More information

MATLAB SUMMARY FOR MATH2070/2970

MATLAB SUMMARY FOR MATH2070/2970 MATLAB SUMMARY FOR MATH2070/2970 DUNCAN SUTHERLAND 1. Introduction The following is inted as a guide containing all relevant Matlab commands and concepts for MATH2070 and 2970. All code fragments should

More information

Getting To Know Matlab

Getting To Know Matlab Getting To Know Matlab The following worksheets will introduce Matlab to the new user. Please, be sure you really know each step of the lab you performed, even if you are asking a friend who has a better

More information

Introduction to Octave/Matlab. Deployment of Telecommunication Infrastructures

Introduction 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 information

Introduction to MATLAB

Introduction 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 information

Matlab Introduction. Scalar Variables and Arithmetic Operators

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 information

Introduction to MATLAB Practical 1

Introduction 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 information

Introduction to. The Help System. Variable and Memory Management. Matrices Generation. Interactive Calculations. Vectors and Matrices

Introduction 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 information

Lab of COMP 406. MATLAB: Quick Start. Lab tutor : Gene Yu Zhao Mailbox: or Lab 1: 11th Sep, 2013

Lab of COMP 406. MATLAB: Quick Start. Lab tutor : Gene Yu Zhao Mailbox: or Lab 1: 11th Sep, 2013 Lab of COMP 406 MATLAB: Quick Start Lab tutor : Gene Yu Zhao Mailbox: csyuzhao@comp.polyu.edu.hk or genexinvivian@gmail.com Lab 1: 11th Sep, 2013 1 Where is Matlab? Find the Matlab under the folder 1.

More information

Dr Richard Greenaway

Dr 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 information

Grace days can not be used for this assignment

Grace days can not be used for this assignment CS513 Spring 19 Prof. Ron Matlab Assignment #0 Prepared by Narfi Stefansson Due January 30, 2019 Grace days can not be used for this assignment The Matlab assignments are not intended to be complete tutorials,

More information

MATLAB Tutorial. Digital Signal Processing. Course Details. Topics. MATLAB Environment. Introduction. Digital Signal Processing (DSP)

MATLAB 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 information

An Introduction to MATLAB See Chapter 1 of Gilat

An Introduction to MATLAB See Chapter 1 of Gilat 1 An Introduction to MATLAB See Chapter 1 of Gilat Kipp Martin University of Chicago Booth School of Business January 25, 2012 Outline The MATLAB IDE MATLAB is an acronym for Matrix Laboratory. It was

More information

Introduction to MATLAB. Simon O Keefe Non-Standard Computation Group

Introduction to MATLAB. Simon O Keefe Non-Standard Computation Group Introduction to MATLAB Simon O Keefe Non-Standard Computation Group sok@cs.york.ac.uk Content n An introduction to MATLAB n The MATLAB interfaces n Variables, vectors and matrices n Using operators n Using

More information

Matlab Tutorial. The value assigned to a variable can be checked by simply typing in the variable name:

Matlab 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 information

MATLAB: The Basics. Dmitry Adamskiy 9 November 2011

MATLAB: 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 information

Matlab notes Matlab is a matrix-based, high-performance language for technical computing It integrates computation, visualisation and programming usin

Matlab notes Matlab is a matrix-based, high-performance language for technical computing It integrates computation, visualisation and programming usin Matlab notes Matlab is a matrix-based, high-performance language for technical computing It integrates computation, visualisation and programming using familiar mathematical notation The name Matlab stands

More information

MATLAB Basics. Configure a MATLAB Package 6/7/2017. Stanley Liang, PhD York University. Get a MATLAB Student License on Matworks

MATLAB 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 information

Experiment 1: Introduction to MATLAB I. Introduction. 1.1 Objectives and Expectations: 1.2 What is MATLAB?

Experiment 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 information

MATLAB Introductory Course Computer Exercise Session

MATLAB Introductory Course Computer Exercise Session MATLAB Introductory Course Computer Exercise Session This course is a basic introduction for students that did not use MATLAB before. The solutions will not be collected. Work through the course within

More information

Ordinary Differential Equation Solver Language (ODESL) Reference Manual

Ordinary Differential Equation Solver Language (ODESL) Reference Manual Ordinary Differential Equation Solver Language (ODESL) Reference Manual Rui Chen 11/03/2010 1. Introduction ODESL is a computer language specifically designed to solve ordinary differential equations (ODE

More information

Matlab Tutorial. Get familiar with MATLAB by using tutorials and demos found in MATLAB. You can click Start MATLAB Demos to start the help screen.

Matlab 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 information

Lecture 2: Variables, Vectors and Matrices in MATLAB

Lecture 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 information

DSP Laboratory (EELE 4110) Lab#1 Introduction to Matlab

DSP Laboratory (EELE 4110) Lab#1 Introduction to Matlab Islamic University of Gaza Faculty of Engineering Electrical Engineering Department 2012 DSP Laboratory (EELE 4110) Lab#1 Introduction to Matlab Goals for this Lab Assignment: In this lab we would have

More information

OUTLINES. Variable names in MATLAB. Matrices, Vectors and Scalar. Entering a vector Colon operator ( : ) Mathematical operations on vectors.

OUTLINES. 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 information

LAB 1: Introduction to MATLAB Summer 2011

LAB 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 information

MATLAB TUTORIAL WORKSHEET

MATLAB 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 information

MAT 275 Laboratory 1 Introduction to MATLAB

MAT 275 Laboratory 1 Introduction to MATLAB MATLAB sessions: Laboratory 1 1 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

More information

Introduction to MATLAB

Introduction 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 information

INTRODUCTION TO MATLAB

INTRODUCTION 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 information

STAT/MATH 395 A - PROBABILITY II UW Winter Quarter Matlab Tutorial

STAT/MATH 395 A - PROBABILITY II UW Winter Quarter Matlab Tutorial STAT/MATH 395 A - PROBABILITY II UW Winter Quarter 2016 Néhémy Lim Matlab Tutorial 1 Introduction Matlab (standing for matrix laboratory) is a high-level programming language and interactive environment

More information

Introduction to Matlab

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

What is MATLAB? It is a high-level programming language. for numerical computations for symbolic computations for scientific visualizations

What is MATLAB? It is a high-level programming language. for numerical computations for symbolic computations for scientific visualizations What is MATLAB? It stands for MATrix LABoratory It is developed by The Mathworks, Inc (http://www.mathworks.com) It is an interactive, integrated, environment for numerical computations for symbolic computations

More information

What is MATLAB and howtostart it up?

What 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 information

Getting Started with MATLAB

Getting Started with MATLAB APPENDIX B Getting Started with MATLAB MATLAB software is a computer program that provides the user with a convenient environment for many types of calculations in particular, those that are related to

More information

A very brief Matlab introduction

A 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 information

Eric 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:

Eric 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 information

ARRAY VARIABLES (ROW VECTORS)

ARRAY VARIABLES (ROW VECTORS) 11 ARRAY VARIABLES (ROW VECTORS) % Variables in addition to being singular valued can be set up as AN ARRAY of numbers. If we have an array variable as a row of numbers we call it a ROW VECTOR. You can

More information

Lecturer: Keyvan Dehmamy

Lecturer: 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 information

CS1114: Matlab Introduction

CS1114: Matlab Introduction CS1114: Matlab Introduction 1 Introduction The purpose of this introduction is to provide you a brief introduction to the features of Matlab that will be most relevant to your work in this course. Even

More information

Introduction to MATLAB

Introduction 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 information

MAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB

MAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB MAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB In this laboratory session we will learn how to 1. Create matrices and vectors. 2. Manipulate matrices and create matrices of special types

More information

12 whereas if I terminate the expression with a semicolon, the printed output is suppressed.

12 whereas if I terminate the expression with a semicolon, the printed output is suppressed. Example 4 Printing and Plotting Matlab provides numerous print and plot options. This example illustrates the basics and provides enough detail that you can use it for typical classroom work and assignments.

More information

To start using Matlab, you only need be concerned with the command window for now.

To start using Matlab, you only need be concerned with the command window for now. Getting Started Current folder window Atop the current folder window, you can see the address field which tells you where you are currently located. In programming, think of it as your current directory,

More information

MATLAB COURSE FALL 2004 SESSION 1 GETTING STARTED. Christian Daude 1

MATLAB 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 information

ECE 202 LAB 3 ADVANCED MATLAB

ECE 202 LAB 3 ADVANCED MATLAB Version 1.2 1 of 13 BEFORE YOU BEGIN PREREQUISITE LABS ECE 201 Labs EXPECTED KNOWLEDGE ECE 202 LAB 3 ADVANCED MATLAB Understanding of the Laplace transform and transfer functions EQUIPMENT Intel PC with

More information

What is MATLAB? What is MATLAB? Programming Environment MATLAB PROGRAMMING. Stands for MATrix LABoratory. A programming environment

What is MATLAB? What is MATLAB? Programming Environment MATLAB PROGRAMMING. Stands for MATrix LABoratory. A programming environment What is MATLAB? MATLAB PROGRAMMING Stands for MATrix LABoratory A software built around vectors and matrices A great tool for numerical computation of mathematical problems, such as Calculus Has powerful

More information

Introduction to MATLAB for Engineers, Third Edition

Introduction 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 information

Introduction to MATLAB programming: Fundamentals

Introduction to MATLAB programming: Fundamentals Introduction to MATLAB programming: Fundamentals Shan He School for Computational Science University of Birmingham Module 06-23836: Computational Modelling with MATLAB Outline Outline of Topics Why MATLAB?

More information

MATLAB Tutorial. 1. The MATLAB Windows. 2. The Command Windows. 3. Simple scalar or number operations

MATLAB Tutorial. 1. The MATLAB Windows. 2. The Command Windows. 3. Simple scalar or number operations MATLAB Tutorial The following tutorial has been compiled from several resources including the online Help menu of MATLAB. It contains a list of commands that will be directly helpful for understanding

More information

MATLAB Tutorial. Mohammad Motamed 1. August 28, generates a 3 3 matrix.

MATLAB 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 information

Matlab Tutorial for COMP24111 (includes exercise 1)

Matlab Tutorial for COMP24111 (includes exercise 1) Matlab Tutorial for COMP24111 (includes exercise 1) 1 Exercises to be completed by end of lab There are a total of 11 exercises through this tutorial. By the end of the lab, you should have completed the

More information

PART 1 PROGRAMMING WITH MATHLAB

PART 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 information

Chapter 1 Introduction to MATLAB

Chapter 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 information

Computational Modelling 102 (Scientific Programming) Tutorials

Computational Modelling 102 (Scientific Programming) Tutorials COMO 102 : Scientific Programming, Tutorials 2003 1 Computational Modelling 102 (Scientific Programming) Tutorials Dr J. D. Enlow Last modified August 18, 2003. Contents Tutorial 1 : Introduction 3 Tutorial

More information

CITS2401 Computer Analysis & Visualisation

CITS2401 Computer Analysis & Visualisation FACULTY OF ENGINEERING, COMPUTING AND MATHEMATICS CITS2401 Computer Analysis & Visualisation SCHOOL OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING Topic 3 Introduction to Matlab Material from MATLAB for

More information

MATLAB GUIDE UMD PHYS375 FALL 2010

MATLAB GUIDE UMD PHYS375 FALL 2010 MATLAB GUIDE UMD PHYS375 FALL 200 DIRECTORIES Find the current directory you are in: >> pwd C:\Documents and Settings\ian\My Documents\MATLAB [Note that Matlab assigned this string of characters to a variable

More information

DSP First. Laboratory Exercise #1. Introduction to MATLAB

DSP First. Laboratory Exercise #1. Introduction to MATLAB DSP First Laboratory Exercise #1 Introduction to MATLAB The Warm-up section of each lab should be completed during a supervised lab session and the laboratory instructor should verify the appropriate steps

More information

Variables are used to store data (numbers, letters, etc) in MATLAB. There are a few rules that must be followed when creating variables in MATLAB:

Variables are used to store data (numbers, letters, etc) in MATLAB. There are a few rules that must be followed when creating variables in MATLAB: Contents VARIABLES... 1 Storing Numerical Data... 2 Limits on Numerical Data... 6 Storing Character Strings... 8 Logical Variables... 9 MATLAB S BUILT-IN VARIABLES AND FUNCTIONS... 9 GETTING HELP IN MATLAB...

More information

Math Sciences Computing Center. University ofwashington. September, Fundamentals Making Plots Printing and Saving Graphs...

Math Sciences Computing Center. University ofwashington. September, Fundamentals Making Plots Printing and Saving Graphs... Introduction to Plotting with Matlab Math Sciences Computing Center University ofwashington September, 1996 Contents Fundamentals........................................... 1 Making Plots...........................................

More information

MATLAB Lesson I. Chiara Lelli. October 2, Politecnico di Milano

MATLAB 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 information