Lab #1 Revision to MATLAB
|
|
- Charles Washington
- 5 years ago
- Views:
Transcription
1 Lab #1 Revision to MATLAB Objectives In this lab we would have a revision to MATLAB, especially the basic commands you have dealt with in analog control. 1. What Is MATLAB? MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to-use environment where problems and solutions are expressed in familiar mathematical notation. Typical uses include: Math and computation. Algorithm development. Data acquisition. Modeling, simulation, and prototyping. Data analysis, exploration, and visualization. Scientific and engineering graphics. Application development, including graphical user interface building. 2. Basic Operations: 2.1 Computation % This is an example of arithmetic >> 1+2 Ans = Suppressing Display of Results >> 1+2; 2.3 The workspace Current values are stored in the MATLAB workspace. The 'who' command tells you what variable are currently defined. The 'whos' command tells you more about the variables. Use the 'clear' command to delete variables from the workspace. >> x=2; >> y=3; >> z=x+y z = 5
2 >> who Your variables are: x y z >> whos Name Size Bytes Class x 1x1 8 double array y 1x1 8 double array z 1x1 8 double array Grand total is 3 elements using 24 bytes >> 2.4 Command Line Editing and Recall: MATLAB does not work like a spreadsheet. It will not go back and repeat calculations unless you tell it to. A comma (, ) separates statements on a line. Three periods ( ) continues on the next line. The up arrow ( ) goes to the previous command. The down arrow ( ) goes to the next command. The sideways arrows move within the command. MATLAB is case sensitive. 2.5 MATLAB Operations and Conventions: Expression follow the standard of precedence Exponentiation. Multiplication and Division. Addition and Subtraction. Expressions are evaluated from left to right. Parentheses work from inner to outer. Complex numbers are entered using the characters ' i ' and ' j ', unless other definitions have been assigned to them. 2.6 To ask for online help with a command, type 'help ' followed by the command name. For instance >> help cos COS Cosine. COS(X) is the cosine of the elements of X. 3. Matrices: MATLAB works essentially with only one kind of object a rectangular numerical matrix with possibly complex entries. All variables represent matrices. A scalar is a 1x1 matrix and a vector is a matrix with only one row or column. There are several ways to enter matrices into MATLAB including: Entering an explicit list of elements
3 Using built-in statement or function. Created in a disk file with your local editor. Loaded from external data files or applications 3.1 Generating Vectors and the Colon Notation We can create a vector (matrix with only one row) by directly inputting the elements >> W=[ ] W = We could also from a vector by using the colon ( : ) operator. " Colon Notation " is used to generate vectors and to reference sub matrices. The colon notation and subscripting by integral vectors and keys to efficient manipulation in MATLAB. Creative use of these features to factorize operations lets you minimize the use of loops (which slows MATLAB down) and makes code simple and readable. >> Q=[1:5] Q = We could also use any increment to construct matrices >> E=[2:2:10] E = Generating Matrices: Column matrices can be created with the semicolon ( ; ) >> A=[1,2,3;4,5,6;7,8,9] A = Referencing Individual Entries: Round parentheses are used to reference individual elements of a matrix
4 >> A(1,2) ans = 2
5 3.4 The colon notation can be used to access sub matrices of a matrix. A(1:4,3) is the column vector consisting of the first 4 entries of the 3rd column of matrix A. 3.5 Deleting Rows and Columns You can delete rows and columns from a matrix using just a pair of square brackets. Start with >> X=[ ; ; ; ] X = >> %To delete the second column of X >> X(:,2)=[] X = Matrix Operations: The following matrix operation are available + addition - subtraction * multiplication ^ power transpose ( real ) or conjugate transpose ( ' complex ).' transpose ( real or complex ) \ left division / right division 4.1 Matrix Division If A is an invertible square matrix and b is a compatible column vector, or respectively a compatible row vector, then
6 x=a\b is the solution of A*x = b x= b/a is the solution of x*a=b 4.2 Entry-Wise Operations The matrix operations addition and subtraction are already entry-wise but the other operations are not; they are matrix operations. The other operation,*,^,\,/ can be made to operate entry-wise by preceding them with a period. >> B=[1 2;3 4] B = >> B*B ans = >> B.*B ans = Matrix Building Functions Eye Zeros Ones Triu Tril Rand Randn For example, >> zeros(2,3) ans = Identity matrix Matrix of zeros Matrix of ones Upper triangular part of matrix Lower triangular part of matrix Uniformly distributed random elements Normally distributed random elements
7 >> A=rand(3) A = >> triu(a) ans = A particular element of a matrix can be assigned: >> M(1,2) = 5; % places the number 5 in the first row, second column Here are some examples: >> Z = zeros(2,4) Z = >> F = 5*ones(3,3) F = >> N = fix(10*rand(1,10)) N = >> R = randn(4,4) R =
8 6. The Colon Operator The colon, :, is one of the most important MATLAB operators. It occurs in several different forms: The expression 1:10 is a row vector containing the integers from 1 to 10, i.e To obtain non-unit spacing, specify an increment. For example, >> 100:-7:50 % a row vector containing the integers from Subscript expressions involving colons refer to portions of a matrix: >> A(1:k,j) % is the first k elements of the jth column of A. So >> sum(a(1:4,4)) % computes the sum of the fourth column. But there is a better way. The colon by itself refers to all the elements in a row or column of a matrix and the keyword end refers to the last row or column. So sum(a(:,end)) % computes the sum of the elements in the last column of A. Exercise 1 1- Generate a matrix of size 4 4 of normally distributed random numbers. 2- Change the value of the 3rd column to [ ]. 3- Delete the 2nd row. Exercise 2 Define the following vector x [n]= n n n Representing Polynomials MATLAB represents polynomials as row vectors containing coefficients ordered by descending powers. For example, consider the equation 3 p(x) = x 2x 5 To enter this polynomial into MATLAB, use >> p = [ ];
9 7.1 Polynomial Roots The roots function calculates the roots of a polynomial. >> r = roots(p) r = i i By convention, MATLAB stores roots in column vectors. The function poly returns to the polynomial coefficients. >> p2 = poly(r) p2 = e poly and roots are inverse functions. 7.2 Characteristic Polynomials The poly function also computes the coefficients of the characteristic polynomial of a matrix. >> A = [ ; ; 9 0 1]; >> poly(a) ans = The roots of this polynomial, computed with roots, are the characteristic roots, or eigenvalues, of the matrix A. (Use eig to compute the eigenvalues of a matrix directly.) 7.3 Polynomial Evaluation The polyval function evaluates a polynomial at a specified value. To evaluate p at s = 5, use >> polyval(p,5) ans = 110 It is also possible to evaluate a polynomial in a matrix sense. In this case p(x) = x3 2x 5 becomes p(x ) = X 3 2X 5I, where X is a square matrix and I is the identity matrix. For example, create a square matrix X and evaluate the polynomial p at X. >> X = [2 4 5; ; 7 1 5]; >> Y = polyvalm(p,x) Y =
10 Exercise 3 Consider the polynomial p(x) = x4 5x3 + 7x Find the roots of this polynomial. 2- From these roots, reconstruct p(x). 3- Find the value of p(x) at x=3. 4- Evaluate the polynomial at X ( matrix sense).
11 8. Graphics in MATALB: 8.1 Creating a Plot The plot function has different forms, depending on the input arguments. If y is a vector, plot(y) produces a piecewise linear graph of the elements of y versus the index of the elements of y. If you specify two vectors as arguments, plot(x,y) produces a graph of y versus x. For example, these statements use the colon operator to create a vector of x values ranging from zero to 2π, compute the sine of these values, and plot the result. >> x = 0:pi/100:2*pi; >> y = sin(x); >> plot(x,y) %Now label the axes and add a title. The characters \pi create the symbol π. >> xlabel('x = 0:2\pi') >> ylabel('sine of x') >> title('plot of the Sine Function','FontSize',12) 8.2 Multiple Data Sets in One Graph Figure 1: Output of the above script Multiple x-y pair arguments create multiple graphs with a single call to plot. MATLAB automatically cycles through a predefined list of colors to allow discrimination among sets of data. For example, these statements plot three related functions of x, each curve in a separate distinguishing color. >> X=0:pi/40:2*pi; >> Y=sin(x); >> y2 = sin(x-.25); >> y3 = sin(x-.5); >> plot(x,y,x,y2,x,y3) % The legend command provides an easy way to identify the individual plots. >> legend('sin(x)','sin(x-.25)','sin(x-.5)')
12 8.3 Specifying Line Styles and Colors It is possible to specify color, line styles, and markers (such as plus signs or circles) when you plot your data using the plot command:. plot(x,y,'color_style_marker') color_style_marker is a string containing from one to four characters (enclosed in single quotation marks) constructed from a color, a line style, and a marker type: Color strings are 'c', 'm', 'y', 'r', 'g', 'b', 'w', and 'k'. These correspond to cyan, magenta, yellow, red, green, blue, white, and black. Line style strings are '-' for solid, '--' for dashed, ':' for dotted, '-.' for dash-dot. Omit the line style for no line. The marker types are '+', 'o', '*', and 'x' and the filled marker types are 's' for square, 'd' for diamond, '^' for up triangle, 'v' for down triangle, '>' for right triangle, '<' for left triangle, 'p' for pentagram, 'h' for hexagram, and none for no marker. 8.4 Adding Plots to an Existing Graph The hold command enables you to add plots to an existing graph. When you type >> hold on MATLAB does not replace the existing graph when you issue another plotting command; it adds the new data to the current graph, rescaling the axes if necessary. For example, these statements first create a contour plot of the peaks function, then superimpose a pseudo color plot of the same function. [x,y,z] = peaks; contour(x,y,z,20,'k') hold on pcolor(x,y,z) shading interp hold off 8.5 Multiple Plots in One Figure The subplot command enables you to display multiple plots in the same window or print them on the same piece of paper. Typing >> subplot(m,n,p) partitions the figure window into an m-by-n matrix of small subplots and selects the pth subplot for the current plot. The plots are numbered along first the top row of the figure window, then the second row, and so on. For example, these statements plot data in four different sub regions of the figure window. >> t = 0:pi/10:2*pi; >> [X,Y,Z] = cylinder(4*cos(t)); >> subplot(2,2,1); mesh(x) >> subplot(2,2,2); mesh(y) >> subplot(2,2,3); mesh(z) >> subplot(2,2,4); mesh(x,y,z)
13
14 8.6 Figure Windows Graphing functions automatically open a new figure window if there are no figure windows already on the screen. If a figure window exists, MATLAB uses that window for graphics output. If there are multiple figure windows open, MATLAB targets the one that is designated the current figure (the last figure used or clicked in). To make an existing figure window the current figure, you can click the mouse while the pointer is in that window or you can type >> figure(n) where n is the number in the figure title bar. The results of subsequent graphics commands are displayed in this window. To open a new figure window and make it the current figure, type figure stem Plot discrete sequence data. stem(y) plots the data sequence Y as stems that extend from equally spaced and automatically generated values along the x-axis. When Y is a matrix, stem plots all elements in a row against the same x value. stem(x,y) plots X versus the columns of Y. X and Y are vectors or matrices of the same size. Additionally, X can be a row or a column vector and Y a matrix with length(x) rows. stem(...,'fill') specifies whether to color the circle at the end of the stem. The following example creates a stem plot of a circular function. >> y = linspace(0,2*pi,10); >> h = stem(cos(y),'fill','-.'); >> set(h(3),'color','r','linewidth',2) % Set base line properties >> axis ([ ]) Figure 2: Stem demonstration
15 Exercise 4 Using MATLAB, plot the function f (t) = e 2t cos(3πt)u(t) where t ranges from 2 to 10. Give the x-axis the title (t sec) and the y-axis the title (f(t) volts ). Repeat using stem function. Then use subplot to combine the two figures in one figure and give it the name: difference between plot and stem. 9. Dimension Functions Size returns the array dimensions d = size(x) returns the sizes of each dimension of array X in a vector d with ndims(x) elements. [m,n] = size(x) returns the size of matrix X in separate variables m and n. m = size(x,dim) returns the size of the dimension of X specified by scalar dim. [d1,d2,d3,...,dn] = size(x) returns the sizes of the first n dimensions of array X in separate variables. length returns the length of vector The statement length(x) is equivalent to max(size(x)) for nonempty arrays and 0 for empty arrays. n = length(x) returns the size of the longest dimension of X. If X is a vector, this is the same as its length. >> x = ones(1,8); >> n = length(x) n = Linear Model Representations The Control System Toolbox supports the following model representations: State-space models (SS) of the form dx dt Ax Bu y= Cx+ Du where A, B, C, and D are matrices of appropriate dimensions, x is the state vector, and u and y are the input and output vectors. Transfer functions (TF), for example,
16 H( s) 2 s s 2 s 10 Zero-pole-gain (ZPK) models, for example, 3( z 1 j)( z 1 j) H( z) ( z 0.2)( z 0.1) Frequency response data (FRD) models, which consist of sampled measurements of a system s frequency response. For example, you can store experimentally collected frequency response data in an FRD model Converting Between Model Representations Now that you have a specific representation of a system, you can convert to other model representations. Transfer Function Representation. You can use tf or ss2tf to convert from the state-space representation to the transfer function. Sys_ tf= ss2 tf (sys_ss) Or Sys_ tf= tf( sys_ss) Zero/ Pole/ Gain Representation. Similarly, the zpk function converts from state-space or transfer function representations to the zero/pole/gain format. sys _ zpk = zpk (sys _ ss) Steady-state Representation. You can use tf2ss to convert from the transfer function representation to state-space model. sys _ ss = tf 2ss(sys _ tf ) 10.2 Constructing Transfer Function and Zero/Pole/Gain Models You can construct a control system model using tf, zpk, ss, or frd. Sys= tf(num,den) %Transfer function Sys= ss (a, b, c, d) %State- space sys= zpk (z,p, k ) %Zero/ pole/ gain sys = frd(response,frequencies)
17 10.3 Data Retrieval The functions tf, zpk, ss, and frd pack the model data and sample time in a single LTI object. Conversely, the following commands provide convenient data retrieval for any type of a TF, SS, or ZPK model sys, or FRD model sysfr. [num, den, Ts] = tfdata (sys) % Ts sample time [z, p, k, Ts] = zpkdata (sys) [a, b, c, d, Ts] = ssdata(sys) [a, b, c, d, e, Ts] = dssdata (ss) [response, frequency, Ts] = frdata (sysfr) Furthermore, you can do the following operations on transfer functions: Zero: Find zeros of the transfer function Pole: Find poles of the transfer function Dc gain: Find the dc gain of the transfer function Exercise 5 Consider the transfer function ( s 3 20( s 2 3s 2 4) 2s 5) 1- Find the poles, zeros, dc gain of the transfer function. 2- Find the equivalent state space model of the system. 3- Find the zero/pole/gain representation of the system. Compare with the results in part Partial Fraction Expansion: You can find the Partial Fraction Expansion (PFE) using the MATLAB command residue. [r,p,k]=residue(num,den); Where r is the vector of PFE coefficients, p the vector of roots of den1, and k=0 if the degree of num1 < the degree of den1.
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 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 informationLogical Subscripting: This kind of subscripting can be done in one step by specifying the logical operation as the subscripting expression.
What is the answer? >> Logical Subscripting: This kind of subscripting can be done in one step by specifying the logical operation as the subscripting expression. The finite(x)is true for all finite numerical
More informationINTRODUCTION TO MATLAB PLOTTING WITH MATLAB
1 INTRODUCTION TO MATLAB PLOTTING WITH MATLAB Plotting with MATLAB x-y plot Plotting with MATLAB MATLAB contains many powerful functions for easily creating plots of several different types. Command plot(x,y)
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 informationMATLAB 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 informationIntroduc)on to Matlab
Introduc)on to Matlab Marcus Kaiser (based on lecture notes form Vince Adams and Syed Bilal Ul Haq ) MATLAB MATrix LABoratory (started as interac)ve interface to Fortran rou)nes) Powerful, extensible,
More informationMatlab Tutorial 1: Working with variables, arrays, and plotting
Matlab Tutorial 1: Working with variables, arrays, and plotting Setting up Matlab First of all, let's make sure we all have the same layout of the different windows in Matlab. Go to Home Layout Default.
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 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 informationMechanical Engineering Department Second Year (2015)
Lecture 7: Graphs Basic Plotting MATLAB has extensive facilities for displaying vectors and matrices as graphs, as well as annotating and printing these graphs. This section describes a few of the most
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 information! The MATLAB language
E2.5 Signals & Systems Introduction to MATLAB! MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to -use environment. Typical
More information12 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 informationBasic Graphs. Dmitry Adamskiy 16 November 2011
Basic Graphs Dmitry Adamskiy adamskiy@cs.rhul.ac.uk 16 November 211 1 Plot Function plot(x,y): plots vector Y versus vector X X and Y must have the same size: X = [x1, x2 xn] and Y = [y1, y2,, yn] Broken
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 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 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 informationMatlab Lecture 1 - Introduction to MATLAB. Five Parts of Matlab. Entering Matrices (2) - Method 1:Direct entry. Entering Matrices (1) - Magic Square
Matlab Lecture 1 - Introduction to MATLAB Five Parts of Matlab MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-touse
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 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 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 informationGetting 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 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 informationMATLAB QUICK START TUTORIAL
MATLAB QUICK START TUTORIAL This tutorial is a brief introduction to MATLAB which is considered one of the most powerful languages of technical computing. In the following sections, the basic knowledge
More informationComputer Programming in MATLAB
Computer Programming in MATLAB Prof. Dr. İrfan KAYMAZ Engineering Faculty Department of Mechanical Engineering Arrays in MATLAB; Vectors and Matrices Graphing Vector Generation Before graphing plots in
More informationWhat is Matlab? A software environment for interactive numerical computations
What is Matlab? A software environment for interactive numerical computations Examples: Matrix computations and linear algebra Solving nonlinear equations Numerical solution of differential equations Mathematical
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 informationQUICK INTRODUCTION TO MATLAB PART I
QUICK INTRODUCTION TO MATLAB PART I Department of Mathematics University of Colorado at Colorado Springs General Remarks This worksheet is designed for use with MATLAB version 6.5 or later. Once you have
More informationIntroduction to Matlab
What is Matlab? Introduction to Matlab Matlab is software written by a company called The Mathworks (mathworks.com), and was first created in 1984 to be a nice front end to the numerical routines created
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 informationPROGRAMMING WITH MATLAB WEEK 6
PROGRAMMING WITH MATLAB WEEK 6 Plot: Syntax: plot(x, y, r.- ) Color Marker Linestyle The line color, marker style and line style can be changed by adding a string argument. to select and delete lines
More informationAn Introduction to MATLAB and the Control Systems toolbox Aravind Parchuri, Darren Hon and Albert Honein
E205 Introduction to Control Design Techniques An Introduction to MATLAB and the Control Systems toolbox Aravind Parchuri, Darren Hon and Albert Honein MATLAB is essentially a programming interface that
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 informationIntroduction to Matlab
Introduction to Matlab Math 339 Fall 2013 First, put the icon in the launcher: Drag and drop Now, open Matlab: * Current Folder * Command Window * Workspace * Command History Operations in Matlab Description:
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 information2. Introduction to Matlab Control System Toolbox
. Introduction to Matlab Control System Toolbox Consider a single-input, single-output (SISO), continuous-time, linear, time invariant (LTI) system defined by its transfer function: u(t) Y( S) num y(t)
More informationMATLAB 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 informationAdditional Plot Types and Plot Formatting
Additional Plot Types and Plot Formatting The xy plot is the most commonly used plot type in MAT- LAB Engineers frequently plot either a measured or calculated dependent variable, say y, versus an independent
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 informationMATLAB Introduction to MATLAB Programming
MATLAB Introduction to MATLAB Programming MATLAB Scripts So far we have typed all the commands in the Command Window which were executed when we hit Enter. Although every MATLAB command can be executed
More informationMatlab 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 informationAn 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 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 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 informationProf. Manoochehr Shirzaei. RaTlab.asu.edu
RaTlab.asu.edu Introduction To MATLAB Introduction To MATLAB This lecture is an introduction of the basic MATLAB commands. We learn; Functions Procedures for naming and saving the user generated files
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 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 informationAppendix 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 informationIntroduction to Matlab
Introduction to Matlab What is Matlab The software program called Matlab (short for MATrix LABoratory) is arguably the world standard for engineering- mainly because of its ability to do very quick prototyping.
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 information1. Register an account on: using your Oxford address
1P10a MATLAB 1.1 Introduction MATLAB stands for Matrix Laboratories. It is a tool that provides a graphical interface for numerical and symbolic computation along with a number of data analysis, simulation
More informationIntroduction to Matlab
Introduction to Matlab November 22, 2013 Contents 1 Introduction to Matlab 1 1.1 What is Matlab.................................. 1 1.2 Matlab versus Maple............................... 2 1.3 Getting
More informationThis module aims to introduce Precalculus high school students to the basic capabilities of Matlab by using functions. Matlab will be used in
This module aims to introduce Precalculus high school students to the basic capabilities of Matlab by using functions. Matlab will be used in subsequent modules to help to teach research related concepts
More informationLab of COMP 406 Introduction of Matlab (II) Graphics and Visualization
Lab of COMP 406 Introduction of Matlab (II) Graphics and Visualization Teaching Assistant: Pei-Yuan Zhou Contact: cspyzhou@comp.polyu.edu.hk Lab 2: 19 Sep., 2014 1 Review Find the Matlab under the folder
More informationHere is a quick introduction to Matlab and a couple of its symbolic and control functions.
Some Matlab 1 Here is a quick introduction to Matlab and a couple of its symbolic and control functions. Matlab is an interpreted language. When you enter a command in the Command window, the line is executed
More informationMATLAB Tutorial III Variables, Files, Advanced Plotting
MATLAB Tutorial III Variables, Files, Advanced Plotting A. Dealing with Variables (Arrays and Matrices) Here's a short tutorial on working with variables, taken from the book, Getting Started in Matlab.
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 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 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 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 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 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 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 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 informationChapter 1 MATLAB Preliminaries
Chapter 1 MATLAB Preliminaries 1.1 INTRODUCTION MATLAB (Matrix Laboratory) is a high-level technical computing environment developed by The Mathworks, Inc. for mathematical, scientific, and engineering
More informationINC151 Electrical Engineering Software Practice. MATLAB Graphics. Dr.Wanchak Lenwari :Control System and Instrumentation Engineering, KMUTT 1
INC151 Electrical Engineering Software Practice MATLAB Graphics Dr.Wanchak Lenwari :Control System and Instrumentation Engineering, KMUTT 1 Graphical display is one of MATLAB s greatest strengths and most
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 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 informationSTAT 391 Handout 1 Making Plots with Matlab Mar 26, 2006
STAT 39 Handout Making Plots with Matlab Mar 26, 26 c Marina Meilă & Lei Xu mmp@cs.washington.edu This is intended to help you mainly with the graphics in the homework. Matlab is a matrix oriented mathematics
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 informationIntroduction 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 informationAMATH 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 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 informationMATLAB 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 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 informationObjectives. 1 Running, and Interface Layout. 2 Toolboxes, Documentation and Tutorials. 3 Basic Calculations. PS 12a Laboratory 1 Spring 2014
PS 12a Laboratory 1 Spring 2014 Objectives This session is a tutorial designed to a very quick overview of some of the numerical skills that you ll need to get started. Throughout the tutorial, the instructors
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 informationGetting Started. Chapter 1. How to Get Matlab. 1.1 Before We Begin Matlab to Accompany Lay s Linear Algebra Text
Chapter 1 Getting Started How to Get Matlab Matlab physically resides on each of the computers in the Olin Hall labs. See your instructor if you need an account on these machines. If you are going to go
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, SIMULINK, AND THE COMMUNICATION TOOLBOX
INTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX 1) Objective The objective of this lab is to review how to access Matlab, Simulink, and the Communications Toolbox, and to become familiar
More informationMATLAB Guide to Fibonacci Numbers
MATLAB Guide to Fibonacci Numbers and the Golden Ratio A Simplified Approach Peter I. Kattan Petra Books www.petrabooks.com Peter I. Kattan, PhD Correspondence about this book may be sent to the author
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 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 informationProgramming 1. Script files. help cd Example:
Programming Until now we worked with Matlab interactively, executing simple statements line by line, often reentering the same sequences of commands. Alternatively, we can store the Matlab input commands
More informationAN 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 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 informationTo 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 informationMATLAB Introduction. Contents. Introduction to Matlab. Published on Advanced Lab (
Published on Advanced Lab (http://experimentationlab.berkeley.edu) Home > References > MATLAB Introduction MATLAB Introduction Contents 1 Introduction to Matlab 1.1 About Matlab 1.2 Prepare Your Environment
More informationIntroduction to PartSim and Matlab
NDSU Introduction to PartSim and Matlab pg 1 PartSim: www.partsim.com Introduction to PartSim and Matlab PartSim is a free on-line circuit simulator that we use in Circuits and Electronics. It works fairly
More informationWhat 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 informationMATLAB for beginners. KiJung Yoon, 1. 1 Center for Learning and Memory, University of Texas at Austin, Austin, TX 78712, USA
MATLAB for beginners KiJung Yoon, 1 1 Center for Learning and Memory, University of Texas at Austin, Austin, TX 78712, USA 1 MATLAB Tutorial I What is a matrix? 1) A way of representation for data (# of
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 informationAMS 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 informationMATLAB Functions and Graphics
Functions and Graphics We continue our brief overview of by looking at some other areas: Functions: built-in and user defined Using M-files to store and execute statements and functions A brief overview
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 informationIntroduction to Matlab to Accompany Linear Algebra. Douglas Hundley Department of Mathematics and Statistics Whitman College
Introduction to Matlab to Accompany Linear Algebra Douglas Hundley Department of Mathematics and Statistics Whitman College August 27, 2018 2 Contents 1 Getting Started 5 1.1 Before We Begin........................................
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 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 information