Chapter 1 MATLAB Preliminaries
|
|
- Russell Underwood
- 5 years ago
- Views:
Transcription
1 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 applications. It is design to perform complex, high-performance numerical analysis and computation. This software integrates computation, visualization, and programming in an easy-to-use environment where problems and solutions are expressed in familiar mathematical notations. Powerful applications such as modeling, data analysis, simulation, exploration, and visualization can be done with this tool. For these reasons, MATLAB has been commonly used in the analysis and design of feedback control systems. 1.2 MATLAB FAMILIARIZATION When you start MATLAB, the MATLAB desktop appears, containing tools (graphical user interfaces) for managing files, variables, and applications associated with MATLAB. The first time MATLAB starts, the desktop appears as shown in Fig The following important entities in the MATLAB user interface are explained in detail. Command Window This is where you input commands like entering values in variables, or running scripts (m-files). M-files are scripts that simply execute a series of MATLAB statements, or they can be functions that also accept arguments and produce outputs. The prompt >> is an indicator where you will input values, basic expressions and scripts. Command History Lines you enter in the Command Window are logged in the Command History window. In the Command History, you can view previously used functions, and copy then execute those selected lines. The text %-- 11:18 AM 4/04/04 --% indicates the Timestamp in which the command was executed, while the succeeding texts indicate the commands performed on that particular time. 4
2 Fig. 1.1 The MATLAB 7.0 environment. Fig. 1.2 The Workspace Browser. 5
3 Workspace Browser The MATLAB Workspace Browser (see Fig. 1.2) consists of the set of variables (named arrays) built up during a MATLAB session and stored in memory. You add variables to the workspace by using these functions, running m-files, and loading saved workspaces. To view the workspace and information about each variable, use the Workspace Browser, or use the functions who and whos. Start Menu The Start Menu consists of various MATLAB Toolboxes and Blocksets. These toolboxes and blocksets are used depending on a specific application, and contain various predefined functions and demos. The Control System Toolbox is used in this text. 1.3 MATLAB FUNDAMENTALS: FUNCTIONS, EXPRESSIONS, AND COMMANDS Once you are familiar with the MATLAB environment, it is time to enter basic expressions. In the command window, all commands are straightforward; just type the expressions such as entering values in a variable or running an m-file. Expressions and Variables Expressions typed without a variable name are evaluated by MATLAB and the result is stored and displayed by a variable called ans. The result of an expression can be assigned to a variable name. Variable names consist of a letter, followed by any number of letters, digits, or underscores. MATLAB uses only the first 31 characters of a variable name and MATLAB is case sensitive. MATLAB is so straightforward that you may enter also mathematical expressions and formulas as you enter the variables. Notice that MATLAB display the result with 5 significant digits (default format: format short). The commands format short e, format long, and format long e display 5 digits floating point, 15 digits fixed point, and 15 digits floating point, respectively. The first example shows a no typed variable expressions, answer is automatically stored in ans. The first expression involves direct value in a variable, while the second one shows a direct mathematical expression using the function cos. Further explanations on Math functions are explained in Elementary Mathematics Functions. Listing 1.1 >>
4 >> cos(3.1416/3) The second example shows an expression with values stored in variables a andb. Listing 1.2 >> a= a = e+002 >> b=3.1416*(cos(3.1416/6))+2 b = e+000 In displaying answers and expressions, the % indicates that any typed expression is converted into a comment while typing a semicolon, ;, after a mathematical expression, omits the MATLAB response or does not display the result. An example is shown in basic display manipulation. The first expression does not display the value of a1 but it is still in the workspace while the second expression is converted into a comment. Listing 1.3 >> a1=3.5445/64; >> % a1=3.5445/64 Using the command fprintf you can directly manipulate the format of the output of an expression or function. This command displays the result with a desired format on the screen or to specified filename. The %8.4f, indicates that the output value is a float number that has 4 decimal values and has 8 characters in length, if length of characters is less than 8 (7 in the example) the 8th would be a space. All expressions inside the single quote sign are the ones to be displayed. The \n indicates that the next output to be displayed (if there s any) would be on the next line. The expression to be evaluated is typed after the comma, sign. Listing 1.4 >> fprintf('area of a circle is %8.4f Square meters\n', *3^2) Area of a circle is Square meters 7
5 MATLAB has several predefined variables and are listed in Table 1.1. You may try the following variables in the Command Window to check their functionality. There are also several commands that perform specific functions. These commands are listed in Table 1.2. It is recommended to try them for you to see how it works. Table 1.1 Special variables and constants. ans Most recent answer computer Computer type eps Floating point relative accuracy i orj Imaginary unit inf Infinity NaN Not-a-number pi or ( ) realmax Largest floating point number realmin Smallest floating point number Table 1.2 MATLAB special commands. clc clear variable diary exit help command home load save who whos variable Clears all input and output from the Command Window display, giving you a "clean screen." Clear the contents and the variable itself in the workspace. Without the variable, it clears the whole workspace Causes a copy of all subsequent command window input and most of the resulting command window output to be appended to the named file. If no file is specified, the file 'diary' is used. Exits MATLAB Ask help on a particular command Same as clc. Read the contents of the MAT-file saved. Saves the workspace to a binary file called a MAT-file, which has a.mat extension. Displays variables in workspace Displays the number of elements in a variable, if no variable is indicated, it displays the values of each variable. 8
6 A sequence of characters in single quotes is called a character string or text variable. Characters can be augmented or combined by using a vector [ first character, second character ] An example is shown below. Listing 1.5 >> c='manila' c = Manila >> cs=[c,',philippines'] cs = Manila,Philippines 1.4 MATLAB COMMANDS AND MATRIX FUNCTIONS MATLAB treats the single value element, like in the first and second example earlier on Expressions and Variables as a single element matrix. From the word MATLAB which means Matrix Laboratory, it explains why values are treated as matrices. Matrices are entered into MATLAB by listing the elements of the matrix and enclosing them within a pair of brackets, [ ]. Elements of a single row are separated by commas or blanks, and rows are separated by semicolons or carriage return. Entering Vectors and Matrices A single row matrix A is entered in MATLAB in two ways, either using spaces or using commas. Listing 1.6 >> A=[ ] A = >> A=[4,32,31,5] A =
7 3 A single column matrix B 4 is entered in MATLAB by using semicolons or carriage 5 returns (in this example, using semicolons). Listing 1.7 >> B=[3;4;5] B = Combining the single column and single row matrix instructions, you can create an m x n 1 2 matrix. If you want to create matrixc 3 4, it is entered in MATLAB by using spaces or commas with semicolons or carriage returns, as shown below. Listing 1.8 >> C=[1 2;3 4] C = The entire row or column can be addressed using colon ;. For example, if you want to get the first row of matrix C, follow the example below. The number 1 denotes first and its location tells whether it is a column or row. If the number is placed on the first position, then it denotes that the output is an entire row and if it is placed in the second position, it denotes an entire column. In our example, the number 1 is placed on the first position; therefore its output is the first row. Try to interchange the colons and numbers to see the corresponding change on the output. Listing 1.9 >> frow=c(1,:) frow = 1 2 >> 10
8 You can also address a single element in a given matrix, we know that a matrix element can be addressed in an expression (i,j), where i is the row and j is the column of the element. Same thing is done here in MATLAB. For example, to get the 1 st row, 2 nd column element of matrix C, which is 2, see the example below. Listing 1.10 >> f12=c(1,2) f12 = 2 Table 1.3 Element-by-element math operations. + Addition - Subtraction.* Element-by-element multiplication../ Element-by-element division..\ Element-by-element left division..^ Element-by-element power. Unconjugated array transpose Matrix / Vector Basic Operations Arithmetic operations on arrays are done element-by-element. This means that addition and subtraction are the same for arrays and matrices, but that multiplicative and division operations are different. Basic operations such as addition and subtraction on matrices with the same dimensions can be done. If they are conformable, two matrices can be multiplied and divided. For element-by-element multiplication and division or array operations, MATLAB uses a dot, or decimal point, as part of the notation for multiplication and division. Element by element operations are listed in Table 1.3. Given two matrices C and D, multiplication can be done by typing >>C*D, element by element multiplication can be done by typing >>C.*D, >>C\D is equivalent to C -1 D, and >>C/D is equivalent to CD -1. The inverse of a matrix, denoted by C -1 can be done by using the command >>inv(c). An example is shown below. 11
9 Listing 1.11 >> C=[1 2;3 4] C = >> D=[5 6;7 8] D = >> C*D >> C\D >> inv(c)*d >> C.*D
10 Transpose and Conjugate Transpose An n vector is a row vector or a column array of n numbers. In MATLAB, elements enclosed by brackets and separated by semicolon generate a column vector. The conjugate transpose of a row vector is a column vector, and vice versa. This can be done in MATLAB using the symbol (apostrophe). An example is shown below, the transpose of matrix D is E. If the matrix is real, the conjugate transpose is simply a transpose. Listing 1.12 >> E=D' E = Special Matrices and Matrix Manipulations Special matrices can be generated by using the functions given in Table 1.4. Table 1.4 Elementary matrices. eye Identity matrix meshgrid x and y arrays for 3-D plots ones Ones matrix zeros Zeros matrix rand Uniformly distributed random numbers randn Normally distributed random numbers Information on a particular matrix can be extracted. This can aid in certain calculations and operations. Try these commands and see how it works. See Table 1.5 for details. Table 1.5 Basic information of a matrix. disp Display array isempty True for empty matrix isequal True if arrays are identical isnumeric True for numeric arrays issparse True for sparse matrix length Length of vector ndims Number of dimensions numel Number of elements size Size of matrix 13
11 Table 1.6 Commands for manipulating matrices. diag Create or extract diagonal fliplr Flip matrix in the left/right direction flipud Flip matrix in the up/down direction reshape change size rot90 Rotate matrix 90 degrees tril Extract lower triangular part triu Extract upper triangular part : Index into matrix, rearrange matrix Table 1.7 Some operations on matrices. det Determinant norm Matrix vector norm trace Sum of diagonal elements inv Matrix inverse eig Eigenvalues and eigenvectors poly Characteristic polynomial exp Matrix exponential logm Matrix logarithm sqrtm Matrix square root Manipulation and creation of matrices can be done using the following MATLAB functions. See Tables 6 and 7. Try the following commands and see how it works. Generating Sequences Vectors can be generated by just specifying the first, last and the increment desired for each element. For example, if you want to create a row vector with a first element of 1 and a last element of 9 and an increment of 1, just use the syntax in the example below. The default increment is 1 so even if you omit the second parameter 1, >>F=(1:9), you still can get the same result. You may try to experiment and change the increment, and see what happens. Listing 1.13 >> F=(1:1:9) F = >> F=(1:9) 14
12 F = Complex Numbers We encounter some problems that include operations and manipulation of complex numbers. Cases like getting the roots of a polynomial or solutions on partial fraction expansion that involves complex roots are common. In MATLAB, imaginary numbers are represented using i or j. Mathematical operations are straightforward, similar to operations in real numbers. As an example, let us perform basic operations of two complex numbers. Given: (25 j65) and (30 j80) (addition and division) Listing 1.14 >> (25+65j)+(30+80j) %Addition e e+002i >> (25+65j)/(30+80j) %Division i We can also extract some parameters from complex numbers like phase angle and magnitude, real part and imaginary part. As an example, we need to get the magnitude and phase angle of the complex number 25 j65. We have to convert the angle in degrees so we multiplied /180 to the answer of angle (always in radians). Listing 1.15 >> abs(25-65i) >> angle(25-65i)*(180/pi) 15
13 >> real(25-65i) ans 25 >> imag(25-65i) ans -65 Matrix Exponential expm(a) is the matrix exponential of an n n matrix A. That is, 2 3 A A expm( A) I A 2! 3! Note that a transcendental function is interpreted as a matrix function if an m is appended to the function name, as in expm(a) or sqrtm(a). Eigenvalues The eigenvalues of a matrix A is found by using the function >>eig(a), which returns the eigenvalues in a column vector. If A is real and symmetric, the eigenvalues will be real. But if A is not symmetric, the eigenvalues are frequently complex in nature. Elementary Mathematics Functions and Operators in MATLAB Elementary math functions and operators in MATLAB are very easy to use since they are basic and straightforward in nature. Basic operations like addition, subtraction, multiplication, division can be represented by +, -, *, / respectively. If you want to raise a number to a certain exponent, just simply insert ^ after the number and before the exponent. For example, if you want to evaluate 2 6, just type >>2^6. For matrices or arrays, operations are different (for exponents, multiplication and division) as stated earlier. Some MATLAB basic math functions automatically operate element by element on an array. Functions that operate element by element are given in Table
14 Table 1.8 Elementary math functions. abs Absolute value acos Inverse cosine acosh Inverse hyperbolic cosine angle Phase angle asin Inverse sine asinh Inverse hyperbolic sine atan Inverse tangent atanh Inverse hyperbolic tangent conj complex conjugate cos Cosine exp Exponential cosh Hyperbolic cosine floor Round towards infinity fix Round towards zero imag Complex Imaginary part log Natural logarithm log10 Common logarithm real Complex real part rem remainder after division round Round towards nearest integer sign Signum function sinh Hyperbolic sine sqrt Square root tan Tangent tanh Hyperbolic tangent Logical Operators MATLAB relational operators and logical operators also work on an element-byelement basis. Relational operators compare two scalars and produce a 1 if the operation is true and a 0 if it is false. For example, if you enter >>t=17>55, MATLAB will respond with t =0. When used with two matrices, relational operators compare corresponding matrix elements. For example, >>L = D <= X will check every element of D against the corresponding element of X. If the element of D is less than or equal to the corresponding element of X, the corresponding element of L will be 1. Otherwise, the corresponding element of L will be zero. The logical operators & for logical AND, for logical OR, and ~ for logical NOT all return 1 for logical TRUE and 0 for logical FALSE. An example is shown below. Listing 1.16 >> H=[ ]; >> I=[ ]; >> J=[ ]; 17
15 >> lgcal1=h<i lgcal1 = >> lgcal2=h>i lgcal2 = >> lgcal3=(h>i)&(h>=j) lgcal3 = CREATING SCRIPTS AND FUNCTIONS (m-files) Files that contain code in the MATLAB language are called m-files. You create m-files using a text editor, then use them as you would any other MATLAB function or command. There are two kinds of m-files: 1. Scripts, which do not accept input arguments or return output arguments. They operate on data in the workspace. 2. Functions, which can accept input arguments and return output arguments. Internal variables are local to the function. Creating Script Files If you're a new MATLAB programmer, just create the m-files that you want to try out in the current directory. As you develop more of your own m-files, you will want to organize them into other directories and personal toolboxes that you can add to MATLAB search path. If you duplicate function names, MATLAB executes the one that occurs first in the search path. Each script file should have a name that ends in.m The commands in the script file are executed in the MATLAB environment by simply entering the name of the script file without the extension.m. An m-file can be created by clicking >FILE>NEW>M-FILE and then a window will appear. You may type your script or code in the m-file window. See Fig
16 Fig. 1.3 MATLAB m-file editor. Creating Functions Function files are m-files that are very similar to script files. The first major difference is that the first line of a function file begins with the word function, followed by a statement identifying the name of the function and the input and output argument in the form: function [output arguments] = function_name(input arguments) Control Flow In your functions or scripts, it is common that you include control flow commands. MATLAB control flow is given in Table 1.9. The control flow commands for, while, and if are statements similar to those used in many computer languages to produce conditional statements or loops. Every for,while, and if statements must be matched with an end statement. The break command can be used to terminate the execution of a loop permanently. The if statement can be used in conjunction with the nargin, 19
17 nargout, and error functions to perform error checking of a function. Inside a function file, nargin and nargout are equal to the number of input and output arguments, respectively, that were used in function call. The function error( message ) returns control to the keyboard and displays message. For more information regarding the commands, please type >> help <command>. Table 1.9 Control flow commands in MATLAB. break Terminate execution of loop else used with if elseif used with if and Terminate the loop for, while, and if statement error Display message and abort function for Repeat statement a specified number of times if conditionally executed statements return return to invoking function while Repeat statements an indefinite number of times 1.6 GENERATING PLOTS MATLAB can create high-resolution, publication-quality 2-D, 3-D, linear, log, semilog, polar, bar chart and contour plots on plotters, dot-matrix printers, and laser printers. Some of the 2-D graph types are plot, loglog, semilogx, semilogy, polar, and bar. The command grid adds a grid to the graph, and the command title( text ), xlabel( text ), ylabel( text ), and text( text ) can be used for labeling and placing text on the graph. MATLAB provides automatic scaling. The function axis([xmin, xmax, ymin, ymax])enforces manual scaling. As an example, let us plot a sinusoidal function, let y 2sin x, where x is the abscissa (an angle) and y is the ordinate. Take note that angles are in radians. The listing is shown below. Listing 1.17 >> x=(0:0.002:2*pi); >> y=2*sin(x); >> plot(x,y); title('sinusoidal waveform'); 20
18 The output waveform is shown in Fig Fig. 1.4 Plot of the function y = 2sinx. 1.7 OTHER MATLAB FUNCTIONS AND COMMANDS FOR CONTROL SYSTEMS ENGINEERING APPLICATIONS The functions to be presented are basic and are commonly used in control systems applications. These functions are not used directly for solving control system problems but rather application of these commands will greatly help in solving them. Polynomials Polynomials can be represented as row vectors containing the coefficients. As an 3 2 example, the polynomial s 32s 32 can be represented as Listing 1.18 >>x=[ ] x = >> The first element of the vector is the coefficient of the highest exponent while the last is the coefficient of the lowest exponent. A 0 is included because there is no s on the polynomial. Polynomials can also be represented in a factor form of its roots such as, 21
19 2 4 5 P s s s s, which can be written using the function poly(), as shown below. Listing 1.19 >> x=poly([ ]) x = For a given characteristic polynomial, its roots can be obtained by using the function roots(). Listing 1.20 >> roots([ ]) Two polynomials can also be multiplied and divided using the conv() and deconv() functions. >> x = [1 2 1]; >> y = [2 5]; >> m = conv(x,y) m = >> n = deconv(x,y) n = Other important functions used in control engineering analysis and design are shown in Table
20 Table 1.10 Other basic functions for control engineering applications. ilaplace Generates the inverse-laplace transform of a polynomial in the s domain. (Requires Symbolic Math Toolbox) laplace Generates the Laplace transform of a polynomial in the time domain. (Requires Symbolic Math Toolbox) polyval Polynomial evaluation. residue Partial fraction expansion. 1.8 MATLAB EXERCISES 1. Generate a 1 3 matrix whose entries are the coefficients of the polynomial 2 N s 2s 3s Generate a 1 4 matrix whose entries are the coefficients of the polynomial 3 2 D s s 6s 11s Determine the product N(s)D(s). 4. Assume a rational function H s H(s). N s D s, determine the partial fraction expansion of 5. Determine the poles and zeros of H(s). (Determine the roots of the numerator and denominator polynomials.) 6. What is the value of H(s) if s = 2? 7. Generate the following matrices: A B 1 0 D I C 3 If possible, determine the following: T T a. AB b. BA c. A A d. A A C e. Show that I3C CI3 C. f. Eigenvalues of C 23
21 2 8. Generate a plot of the function f t 1 (0.9) cos t 9. Solve the system of linear equations for 5 cycles. x 2y 3z 2w 2 2y 6w 1 2x z w 0 y 6z Determine the rank of the coefficient matrix developed in No. 9 using the function rank. 11. Augment the constant matrix in No. 9 to the coefficient matrix also in No. 9. Determine the Reduced Row Echelon Form of this augmented matrix by using the function rref. What is the significance of this result? 12. Generate the vector x without typing the entries manually, and by using the functions ones and zeros only. 13. Determine the size of the matrix generated in No. 9 using the function size. 14. Determine the length of the matrix generated in No. 9 using the function length. 15. What is the difference between size and length? 24
A 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 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 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 informationA Guide to Using Some Basic MATLAB Functions
A Guide to Using Some Basic MATLAB Functions UNC Charlotte Robert W. Cox This document provides a brief overview of some of the essential MATLAB functionality. More thorough descriptions are available
More informationDr Richard Greenaway
SCHOOL OF PHYSICS, ASTRONOMY & MATHEMATICS 4PAM1008 MATLAB 2 Basic MATLAB Operation Dr Richard Greenaway 2 Basic MATLAB Operation 2.1 Overview 2.1.1 The Command Line In this Workshop you will learn how
More informationshort-reference.mht 1/ /WK/
short-reference.mht 1/6 6KRUW0$7/$%5HIHUHQFH There are many MATLAB features which cannot be included in these introductory notes. Listed below are some of the MATLAB functions and operators available,
More informationIntroduction to Scientific and Engineering Computing, BIL108E. Karaman
USING MATLAB INTRODUCTION TO SCIENTIFIC & ENGINEERING COMPUTING BIL 108E, CRN24023 To start from Windows, Double click the Matlab icon. To start from UNIX, Dr. S. Gökhan type matlab at the shell prompt.
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 informationMATH 3511 Basics of MATLAB
MATH 3511 Basics of MATLAB Dmitriy Leykekhman Spring 2012 Topics Sources. Entering Matrices. Basic Operations with Matrices. Build in Matrices. Build in Scalar and Matrix Functions. if, while, for m-files
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 informationMATH 5520 Basics of MATLAB
MATH 5520 Basics of MATLAB Dmitriy Leykekhman Spring 2011 Topics Sources. Entering Matrices. Basic Operations with Matrices. Build in Matrices. Build in Scalar and Matrix Functions. if, while, for m-files
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 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 informationGeneral MATLAB Information 1
Introduction to MATLAB General MATLAB Information 1 Once you initiate the MATLAB software, you will see the MATLAB logo appear and then the MATLAB prompt >>. The prompt >> indicates that MATLAB is awaiting
More informationFundamentals of MATLAB Usage
수치해석기초 Fundamentals of MATLAB Usage 2008. 9 담당교수 : 주한규 joohan@snu.ac.kr, x9241, Rm 32-205 205 원자핵공학과 1 MATLAB Features MATLAB: Matrix Laboratory Process everything based on Matrix (array of numbers) Math
More informationLecturer: Keyvan Dehmamy
MATLAB Tutorial Lecturer: Keyvan Dehmamy 1 Topics Introduction Running MATLAB and MATLAB Environment Getting help Variables Vectors, Matrices, and linear Algebra Mathematical Functions and Applications
More informationMATLAB and Numerical Analysis
School of Mechanical Engineering Pusan National University dongwoonkim@pusan.ac.kr Teaching Assistant 김동운 dongwoonkim@pusan.ac.kr 윤종희 jongheeyun@pusan.ac.kr Lab office: 통합기계관 120호 ( 510-3921) 방사선영상연구실홈페이지
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 informationStarting MATLAB To logon onto a Temple workstation at the Tech Center, follow the directions below.
What is MATLAB? MATLAB (short for MATrix LABoratory) is a language for technical computing, developed by The Mathworks, Inc. (A matrix is a rectangular array or table of usually numerical values.) MATLAB
More informationIntroduction to MATLAB
to MATLAB Spring 2019 to MATLAB Spring 2019 1 / 39 The Basics What is MATLAB? MATLAB Short for Matrix Laboratory matrix data structures are at the heart of programming in MATLAB We will consider arrays
More 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 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 informationIntroduction to. The Help System. Variable and Memory Management. Matrices Generation. Interactive Calculations. Vectors and Matrices
Introduction to Interactive Calculations Matlab is interactive, no need to declare variables >> 2+3*4/2 >> V = 50 >> V + 2 >> V Ans = 52 >> a=5e-3; b=1; a+b Most elementary functions and constants are
More informationArithmetic and Logic Blocks
Arithmetic and Logic Blocks The Addition Block The block performs addition and subtractions on its inputs. This block can add or subtract scalar, vector, or matrix inputs. We can specify the operation
More informationPart #1. A0B17MTB Matlab. Miloslav Čapek Filip Kozák, Viktor Adler, Pavel Valtr
A0B17MTB Matlab Part #1 Miloslav Čapek miloslav.capek@fel.cvut.cz Filip Kozák, Viktor Adler, Pavel Valtr Department of Electromagnetic Field B2-626, Prague You will learn Scalars, vectors, matrices (class
More informationIntroduction to GNU-Octave
Introduction to GNU-Octave Dr. K.R. Chowdhary, Professor & Campus Director, JIETCOE JIET College of Engineering Email: kr.chowdhary@jietjodhpur.ac.in Web-Page: http://www.krchowdhary.com July 11, 2016
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 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 informationComputer Programming in MATLAB
Computer Programming in MATLAB Prof. Dr. İrfan KAYMAZ Atatürk University Engineering Faculty Department of Mechanical Engineering What is a computer??? Computer is a device that computes, especially a
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 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 informationFinding, Starting and Using Matlab
Variables and Arrays Finding, Starting and Using Matlab CSC March 6 &, 9 Array: A collection of data values organized into rows and columns, and known by a single name. arr(,) Row Row Row Row 4 Col Col
More informationMatlab Workshop I. Niloufer Mackey and Lixin Shen
Matlab Workshop I Niloufer Mackey and Lixin Shen Western Michigan University/ Syracuse University Email: nil.mackey@wmich.edu, lshen03@syr.edu@wmich.edu p.1/13 What is Matlab? Matlab is a commercial Matrix
More informationMATLAB Lesson I. Chiara Lelli. October 2, Politecnico di Milano
MATLAB Lesson I Chiara Lelli Politecnico di Milano October 2, 2012 MATLAB MATLAB (MATrix LABoratory) is an interactive software system for: scientific computing statistical analysis vector and matrix computations
More informationA Quick Tutorial on MATLAB. Zeeshan Ali
A Quick Tutorial on MATLAB Zeeshan Ali MATLAB MATLAB is a software package for doing numerical computation. It was originally designed for solving linear algebra type problems using matrices. It's name
More informationIntroduction to MATLAB
Introduction to MATLAB 1 Introduction to MATLAB A Tutorial for the Course Computational Intelligence http://www.igi.tugraz.at/lehre/ci Stefan Häusler Institute for Theoretical Computer Science Inffeldgasse
More 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 informationProgramming in Mathematics. Mili I. Shah
Programming in Mathematics Mili I. Shah Starting Matlab Go to http://www.loyola.edu/moresoftware/ and login with your Loyola name and password... Matlab has eight main windows: Command Window Figure Window
More informationExperiment 1: Introduction to MATLAB I. Introduction. 1.1 Objectives and Expectations: 1.2 What is MATLAB?
Experiment 1: Introduction to MATLAB I Introduction MATLAB, which stands for Matrix Laboratory, is a very powerful program for performing numerical and symbolic calculations, and is widely used in science
More informationA GUIDE FOR USING MATLAB IN COMPUTER SCIENCE AND COMPUTER ENGINEERING TABLE OF CONTENTS
A GUIDE FOR USING MATLAB IN COMPUTER SCIENCE AND COMPUTER ENGINEERING MARC THOMAS AND CHRISTOPHER PASCUA TABLE OF CONTENTS 1. Language Usage and Matlab Interface 1 2. Matlab Global Syntax and Semantic
More informationTeaching Manual Math 2131
Math 2131 Linear Algebra Labs with MATLAB Math 2131 Linear algebra with Matlab Teaching Manual Math 2131 Contents Week 1 3 1 MATLAB Course Introduction 5 1.1 The MATLAB user interface...........................
More informationELEC4042 Signal Processing 2 MATLAB Review (prepared by A/Prof Ambikairajah)
Introduction ELEC4042 Signal Processing 2 MATLAB Review (prepared by A/Prof Ambikairajah) MATLAB is a powerful mathematical language that is used in most engineering companies today. Its strength lies
More 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 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 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 informationMATLAB Lecture 1. Introduction to MATLAB
MATLAB Lecture 1. Introduction to MATLAB 1.1 The MATLAB environment MATLAB is a software program that allows you to compute interactively with matrices. If you want to know for instance the product of
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 informationIntroduction to Engineering gii
25.108 Introduction to Engineering gii Dr. Jay Weitzen Lecture Notes I: Introduction to Matlab from Gilat Book MATLAB - Lecture # 1 Starting with MATLAB / Chapter 1 Topics Covered: 1. Introduction. 2.
More informationIntroduction to MATLAB
Introduction to MATLAB Introduction MATLAB is an interactive package for numerical analysis, matrix computation, control system design, and linear system analysis and design available on most CAEN platforms
More informationIntroduction to MATLAB
Introduction to MATLAB The Desktop When you start MATLAB, the desktop appears, containing tools (graphical user interfaces) for managing files, variables, and applications associated with MATLAB. The following
More informationScript started on Thu 25 Aug :00:40 PM CDT
Script started on Thu 25 Aug 2016 02:00:40 PM CDT < M A T L A B (R) > Copyright 1984-2014 The MathWorks, Inc. R2014a (8.3.0.532) 64-bit (glnxa64) February 11, 2014 To get started, type one of these: helpwin,
More informationIntroduction to MATLAB Programming
Introduction to MATLAB Programming Arun A. Balakrishnan Asst. Professor Dept. of AE&I, RSET Overview 1 Overview 2 Introduction 3 Getting Started 4 Basics of Programming Overview 1 Overview 2 Introduction
More informationMATLAB Programming for Numerical Computation Dr. Niket Kaisare Department Of Chemical Engineering Indian Institute of Technology, Madras
MATLAB Programming for Numerical Computation Dr. Niket Kaisare Department Of Chemical Engineering Indian Institute of Technology, Madras Module No. #01 Lecture No. #1.1 Introduction to MATLAB programming
More informationMath 2250 MATLAB TUTORIAL Fall 2005
Math 2250 MATLAB TUTORIAL Fall 2005 Math Computer Lab The Mathematics Computer Lab is located in the T. Benny Rushing Mathematics Center (located underneath the plaza connecting JWB and LCB) room 155C.
More informationLab 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 informationLecture 1: What is MATLAB?
Lecture 1: What is MATLAB? Dr. Mohammed Hawa Electrical Engineering Department University of Jordan EE201: Computer Applications. See Textbook Chapter 1. MATLAB MATLAB (MATrix LABoratory) is a numerical
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 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 informationMATLAB Tutorial. Mohammad Motamed 1. August 28, generates a 3 3 matrix.
MATLAB Tutorial 1 1 Department of Mathematics and Statistics, The University of New Mexico, Albuquerque, NM 87131 August 28, 2016 Contents: 1. Scalars, Vectors, Matrices... 1 2. Built-in variables, functions,
More 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 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 informationECON 502 INTRODUCTION TO MATLAB Nov 9, 2007 TA: Murat Koyuncu
ECON 502 INTRODUCTION TO MATLAB Nov 9, 2007 TA: Murat Koyuncu 0. What is MATLAB? 1 MATLAB stands for matrix laboratory and is one of the most popular software for numerical computation. MATLAB s basic
More informationA. Matrix-wise and element-wise operations
USC GSBME MATLAB CLASS Reviewing previous session Second session A. Matrix-wise and element-wise operations A.1. Matrix-wise operations So far we learned how to define variables and how to extract data
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 informationA QUICK INTRODUCTION TO MATLAB
A QUICK INTRODUCTION TO MATLAB Very brief intro to matlab Basic operations and a few illustrations This set is independent from rest of the class notes. Matlab will be covered in recitations and occasionally
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 informationMATLAB Premier. Middle East Technical University Department of Mechanical Engineering ME 304 1/50
MATLAB Premier Middle East Technical University Department of Mechanical Engineering ME 304 1/50 Outline Introduction Basic Features of MATLAB Prompt Level and Basic Arithmetic Operations Scalars, Vectors,
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 informationIntroduction to MATLAB for CSE390
Introduction Introduction to MATLAB for CSE390 Professor Vijay Kumar Praveen Srinivasan University of Pennsylvania MATLAB is an interactive program designed for scientific computations, visualization and
More informationIntroduction to MATLAB Practical 1
Introduction to MATLAB Practical 1 Daniel Carrera November 2016 1 Introduction I believe that the best way to learn Matlab is hands on, and I tried to design this practical that way. I assume no prior
More informationYOGYAKARTA STATE UNIVERSITY MATHEMATICS AND NATURAL SCIENCES FACULTY MATHEMATICS EDUCATION STUDY PROGRAM
YOGYAKARTA STATE UNIVERSITY MATHEMATICS AND NATURAL SCIENCES FACULTY MATHEMATICS EDUCATION STUDY PROGRAM TOPIC 1 INTRODUCING SOME MATHEMATICS SOFTWARE (Matlab, Maple and Mathematica) This topic provides
More informationA QUICK INTRODUCTION TO MATLAB. Intro to matlab getting started
A QUICK INTRODUCTION TO MATLAB Very brief intro to matlab Intro to matlab getting started Basic operations and a few illustrations This set is indepent from rest of the class notes. Matlab will be covered
More informationIntroduction to MATLAB
Outlines September 9, 2004 Outlines Part I: Review of Previous Lecture Part II: Part III: Writing MATLAB Functions Review of Previous Lecture Outlines Part I: Review of Previous Lecture Part II: Part III:
More informationPart V Appendices c Copyright, Todd Young and Martin Mohlenkamp, Department of Mathematics, Ohio University, 2017
Part V Appendices c Copyright, Todd Young and Martin Mohlenkamp, Department of Mathematics, Ohio University, 2017 Appendix A Glossary of Matlab Commands Mathematical Operations + Addition. Type help plus
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 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 informationBuilt-in Types of Data
Built-in Types of Data Types A data type is set of values and a set of operations defined on those values Python supports several built-in data types: int (for integers), float (for floating-point numbers),
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 informationIntroduction 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 informationMatlab course at. P. Ciuciu 1,2. 1: CEA/NeuroSpin/LNAO 2: IFR49
Matlab course at NeuroSpin P. Ciuciu 1,2 philippe.ciuciu@cea.fr www.lnao.fr 1: CEA/NeuroSpin/LNAO 2: IFR49 Feb 26, 2009 Outline 2/9 Lesson0: Getting started: environment,.m and.mat files Lesson I: Scalar,
More informationMatlab Tutorial, CDS
29 September 2006 Arrays Built-in variables Outline Operations Linear algebra Polynomials Scripts and data management Help: command window Elisa (see Franco next slide), Matlab Tutorial, i.e. >> CDS110-101
More informationEbooks Chemical Engineering
Uploaded by: Ebooks Chemical Engineering https://www.facebook.com/pages/ebooks-chemical-engineering/238197077030 For More Books, softwares & tutorials Related to Chemical Engineering Join Us @facebook:
More informationMAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB
MAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB MATLAB is a computer software commonly used in both education and industry to solve a wide range of problems. This Laboratory provides a brief
More 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 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 Constants, Variables & Expression. 9/12/2015 By: Nafees Ahmed
MATLAB Constants, Variables & Expression Introduction MATLAB can be used as a powerful programming language. It do have IF, WHILE, FOR lops similar to other programming languages. It has its own vocabulary
More informationPART 1 PROGRAMMING WITH MATHLAB
PART 1 PROGRAMMING WITH MATHLAB Presenter: Dr. Zalilah Sharer 2018 School of Chemical and Energy Engineering Universiti Teknologi Malaysia 23 September 2018 Programming with MATHLAB MATLAB Environment
More informationIntroduction to MATLAB
58:110 Computer-Aided Engineering Spring 2005 Introduction to MATLAB Department of Mechanical and industrial engineering January 2005 Topics Introduction Running MATLAB and MATLAB Environment Getting help
More informationMATLAB 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 informationMATLAB BASICS. M Files. Objectives
Objectives MATLAB BASICS 1. What is MATLAB and why has it been selected to be the tool of choice for DIP? 2. What programming environment does MATLAB offer? 3. What are M-files? 4. What is the difference
More informationELEMENTARY MATLAB PROGRAMMING
1 ELEMENTARY MATLAB PROGRAMMING (Version R2013a used here so some differences may be encountered) COPYRIGHT Irving K. Robbins 1992, 1998, 2014, 2015 All rights reserved INTRODUCTION % It is assumed the
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 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 informationCME 192: Introduction to Matlab
CME 192: Introduction to Matlab Matlab Basics Brett Naul January 15, 2015 Recap Using the command window interactively Variables: Assignment, Identifier rules, Workspace, command who and whos Setting the
More informationMcTutorial: A MATLAB Tutorial
McGill University School of Computer Science Sable Research Group McTutorial: A MATLAB Tutorial Lei Lopez Last updated: August 2014 w w w. s a b l e. m c g i l l. c a Contents 1 MATLAB BASICS 3 1.1 MATLAB
More informationOutline. CSE 1570 Interacting with MATLAB. Starting MATLAB. Outline (Cont d) MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An
CSE 170 Interacting with MATLAB Instructor: Aijun An Department of Computer Science and Engineering York University aan@cse.yorku.ca Outline Starting MATLAB MATLAB Windows Using the Command Window Some
More informationConsider this m file that creates a file that you can load data into called rain.txt
SAVING AND IMPORTING DATA FROM A DATA FILES AND PROCESSING AS A ONE DIMENSIONAL ARRAY If we save data in a file sequentially than we can call it back sequentially into a row vector. Consider this m file
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
Introduction to MATLAB (MATrix LABoratory) Presented By: Dr Mostafa Elshahed Asst. Prof. 1 Upon completing this course, the student should be able to: Learn a brief introduction to programming in MATLAB.
More informationMATLAB Premier. Asst. Prof. Dr. Melik DÖLEN. Middle East Technical University Department of Mechanical Engineering 10/30/04 ME 304 1
MATLAB Premier Asst. Prof. Dr. Melik DÖLEN Middle East Technical University Department of Mechanical Engineering 0/0/04 ME 04 Outline! Introduction! Basic Features of MATLAB! Prompt Level and Basic Aritmetic
More information