CHAPTER 3 PART 1 MATLAB FUNDAMENTALS
|
|
- Alyson Daniels
- 5 years ago
- Views:
Transcription
1 CHAPTER 3 PART 1 MATLAB FUNDAMENTALS
2 Chapter 3 : TOPIC COVERS (PROGRAMMING with MATLAB) MATLAB Environment Use of Built-In Functions and Graphics
3 LEARNING OUTCOMES INTRODUCTION It is expected that students will be able to: Gaining general understanding of MATLAB programming language Use built-in function to solve equation and plot graph
4 3.1 MATLAB Environment MATLAB is a computer program with convenient environment for performing many types of calculations especially for implement NM First part of Chapter 3 will introduce with calculator/interactive commands mode operations and creating plots. Second part of Chapter 3 will show how such commands can be used to create MATLAB programs. The best way to follow this chapter is by implement the commands on MATLAB/computer as we through the exercises/examples.
5 There are three primary windows in MATLAB programs: 1. Command window (to enter commands and data): 1 st part 2. Graphics window (to display plots and graphs): 1 st part 3. Edit window (to create and edit M-files): 2 nd part Starting MATLAB with command window prompt/quick being displayed as: >> Calculator mode of MATLAB operates in a sequential/in order fashion as you type in commands line by line and will give you results as punch enter. For an example: >> MATLAB will display the result: 20
6 We also can assign the answer (ans) as a variable: >> ans + 11 The result will be : >> = 31
7 3.2 ASSIGNMENT Assignment : to assigning values to variable names Scalars Assignment of values to scalar variables is similar to other computer languages: >> a = 4 Echo/repeat prints (produces) to confirm what you have done: a = 4 Echo/repeat printing is a characteristic of MATLAB. Echo printing can be terminated by the command line with the semicolon (;) character.
8 Then, try typing: >> a = 4, A = 6; x = 1; a = 4 MATLAB treats names in a case-sensitive manner : the small a is not the same as the capital A. Try typing : >> a and then enter; >> A They are difference (between a and A) names!!
9 MATLAB can assign complex values to variables. The unit imaginary number is pre-assigned to the variable i. So, a complex value can be assigned simply as : >> x = 2 + i*4 x = i MATLAB is also allows the symbol j to be used to represent the unit imaginary number for input, however, it always uses/shows an i for display. For example; >> x = 2 + j*4 x = i can assign complex values to variables.
10 MATLAB has several predefined variables, for example pi. >> pi See how MATLAB display four decimal places. However, if you desire additional precision, enter the following; >> format long Now when pi is entered the result is displayed to 15 significant figures: >> pi
11 To return to the four decimal version, type: >> format short >> pi Then enter;
12 The following table shows summary of the format commands you will employ routinely in engineering and scientific calculations. They all have the syntax: format type type Results Example short Scale fixed-point format with 5 digits long Scale fixed-point format with 15 digits for double and 7 digits for single short e Floating-point format with 5 digits e+000 long e Floating-point format with 15 digits for double and 7 digits for single e+000 short g Best of fixed- or floating-point with 5 digits long g Best of fixed- or floating-point with 15 digits for double and 7 digits for single short eng Engineering format with at least 5 digits and a power that is a multiple of e+000 long eng Engineering format with exactly 16 significant digits and a power that is a multiple of 3 bank Fixed dollars and cents e+000
13 3.2.2 Arrays/Arrangements, Vectors and Matrices Arrays: is a collections/selection of values that are represented by a single variable name One-dimensional arrays are called Vector and two-dimensional arrays are called Matrices. (The Scalar used in section are actually a matrix with one row and one column) Brackets are used to enter arrays in the command mode. For example, a row vector can be assigned as follows: >> a = [ ] >> a = Note that this assignment overrides the previous assignment of a = 4
14 However, in practice row vectors are rarely/seldom used to solve mathematical problems. If we speak about vectors, we usually refer to column vectors, which are more commonly used. A column vector can be entered in several ways. For examples: >> b = [ 2 ; 4 ; 6 ; 8 ; 10 ] or >> b = [ 2 ; 4 ; 6; 8; 10 ] or, by transposing a row vector with the operator (prime symbol); >> b = [ ]
15 A result in all three cases will be : >> b = Thus, an example of matrix (3x3) can be assigned as follows: >> A = [ ; ; ] A =
16 In addition, the Enter key (carriage return) can be used to separate the row. For example, in the following case, the Enter key would be struck after 3, the 6 and the ] to assign the matrix as: >> A = [ ] At any point in a session, a list of all current variables can be obtained by entering the who command: >> who Your variables are : A a ans b x Or, with more detail, enter the whos command: >> whos
17 >> whos Name Size Bytes Class A 3x3 72 double array a 1x5 40 double array ans 1x1 8 double array b 5x1 40 double array x 1x1 16 double array (complex) Grand total is 21 elements using 176 bytes Subscript notation can be used to access an individual element of any array. For example, the 4 th element of the column vector b can be displayed as: >> b (4) 8
18 For any array, A(m,n) selects the element in m th row and the n th column. For example, >> A (2, 3) 6 They are several built-in functions that can be used to create matrices. For example, the one and zeros functions create vectors or matrices filled with ones and zeros, respectively. Both have two arguments/influence, the first for the number of rows and the second for the number of columns. For example, to create a 2x3 matrix of zeros: >> E = zeros (2, 3) E =
19 Similarly, the ones function can be used to create a row vector of ones: >> u = ones (1, 3) u = 1 1 1
20 3.2.3 Colon ( : ) Operator Colon operator: is a powerful tool for crating and manipulating arrays (collections/arrangements of values). If a colon is used to separate two number, MATLAB generates the numbers between them using increment of one, for example: >> t = 1 : 5 t = If colons are used to separate three numbers, MATLAB generates the numbers between the first and third numbers using an increment equal to the second number: >> t = 1 : 0.5 : 3 t =
21 For negative increments: >> t = 10 : -1 : 5 t = Aside from creating series of numbers, the colon can also be used as a wildcards/randomly to select the individual rows and columns of a matrix. In here, the colon represents the entire row and column. For example, a second row of the matrix A can be selected as: >> A (2, : ) 4 5 6
22 The colon notation/entry is used to selectively extract a series of elements from within an array. For example, based on the previous definition of the vector t : >> t (2 : 4) In here, the second through the fourth elements are returned/came back.
23 3.2.4 The linspace and logspace Functions They are used to generate vectors of spaced points. The linespace function generates a row vector of equally spaced points. For example: >> linspace (x1, x2, n) which generates n points between x1 and x2. For example : >> linspace (0, 1, 6) Ans = If the n is omitted/excluded, the function automatically generates 100 points.
24 The logspace function generates a row vector that is logarithmically equally spaced. It has the form : >> logspace (x1, x2, n) which generates n logarithmically equal spaced points between decades 10 x1 and 10 x2. For example : >> logspace (-1, 2, 4) If the n is omitted/excluded, it automatically generates 50 points.
25 3.3 MATHEMATICAL OPERATIONS Operation with scalar quantities are handled in a straightforward manner, similar to other computer languages. The common operators, in order of priority, are : Symbol Explanation ^ Exponentiation - Negation * / Multiplication and division \ Left division Addition and subtraction
26 These operators will work in calculator fashion. For example : >> 2 * pi Also, scalar real variables can be included : For example : >> y = pi/4; >> y ^ This result of calculation can be assigned to a variable.
27 The priority order can be overridden/overrule with parentheses/addition comment. For example, because exponentiation (^) has higher priority then negation (-), the following result would be obtained : >> y = - 4 ^ 2 y = - 16 Thus, 4 is first squared and then negated. Parentheses can be used to overridden the priorities as : >> y = (- 4) ^ 2 y = 16
28 Calculations can also involve complex quantities. Here are some examples that values of x (2 + 4i) and y (16) defined previously >> 3 * x i >> 1 / x i >> x ^ i >> x + y i
29 The real power of MATLAB is in ability to carry out vector-matrix calculations. Most of the calculation will be discussed in Chapter 5 (Linear Algebraic Equations). However, some of vector-matrix calculation will be shown, for example: the inner product of two vectors (dot product) can be calculated using the * operator. >> a * b 110 and likewise, the outer product: >> b * a
30 To further illustrate vector-matrix multiplication, first redefine a and b: >> a = [1 2 3]; and >> b = [4 5 6] now, try; >> a * A or >> A * b
31 Matrices cannot be multiplied if the inner dimensions are unequal. Here what happens when the dimensions are unequal: >> A * a MATLAB automatically display the error message:?? Error using ==> mtimes Inner matrix dimensions must agree Matrix-matrix multiplication is carried out in likewise fashion: >> A * A
32 Mixed operations with scalars are also possible, for example: >> A / pi Example for calculations items by items in a matrix or vector: >> A ^ The result (above) after matrix multiplication of A with itself.
33 To make square each element of A, for example : Note: the. preceding the ^ operator signifies that the operation is to be carried out element by element. MATLAB manuals calls these as array operations or element-byelement operations >> A.^
34 MATLAB can obtain shortcut for viewing the calculation/operation that you ve already done. Just press the up-arrow key, you should get back the last line you type in. For example, previously: >> A.^ 2 Then, by pressing Enter will perform the calculation again. But you can also edit this line. For example, change it to the line below and then press Enter: >> A.^
35 3.4 BUILT-IN/FITTED FUNCTIONS (in MATLAB program) MATLAB and its Toolboxes have a rich collection of built-in functions. Use online help to find out more. For example, if you want to learn about the log function, type in : >> help log LOG Natural logarithm LOG (X) is the natural logarithm of the elements of x. Complex results are produced if X is not positive. See also LOG2, LOG10, EXP, LOGM. For a list of all the elementary functions, type : >> help elfun
36 One of important properties of MATLAB s built-in functions is that they will operate directly on vector and matrix quantities. For example : >> log (A) The result is that the natural logarithm function is applied in array/dispaly style, element by element, to the matrix A. Most functions, such as sqrt, abs, sin, acos, tanh, and exp, operate in array fashion.
37 For certain functions, such as exponential (exp) and square root (sqrt), have matrix definition as well. MATLAB will evaluate the matrix version when the letter m is appended to the function name. For example : >> sqrtm (A) i i i i i i i i i There are several functions for rounding. The round function rounds the elements of E to the nearest integer/digit. For example : >> E = [ ] >> round (E)
38 The ceil (short for ceiling) function round to the nearest integers toward infinity : >> ceil (E) The floor function rounds down to the nearest integers toward minus infinity : >> floor (E)
39 For the function with special actions on the elements of matrices and arrays. For example, the sum function returns the sum of the elements : >> F = [ ] >> sum (F) 19 Try others commands as well : >> min (F), max (F), mean (F), prod (F), sort (F) Prod. of : 1 x 3 x 4 x 5 x 6 = 360
40 A common use of functions is to evaluate a formula for a series of arguments. For example a free-falling bungee jumper can be compute as (equation 1.9) : v gm c d tanh gc m d t Where, v = velocity (m/s) g = acceleration due to gravity (9.81 m/s 2 ) m = mass (kg) t = time (s) c d = drag coefficient (kg/m)
41 Question: Create a column vector t that contains values from 0 to 20 in steps of 2? Answer: >> t = [ 0 : 2 : 20 ] t =
42 Check the number of items in the t array with the length function : >> length (t) Ans = 11 Then assign values to the parameters/limits : >> g = 9.81; m = 68.1; cd = 0.25; MATLAB allows you to evaluate such as v = f (t), where the formula is computed for each value of the t array, and the result is assigned to a corresponding position in the v array. For our case : >> v = sqrt (g * m/cd) * tanh (sqrt (g * cd/m) * t)
43 v =
44 3.5 GRAPHICS/GRAPHS/FIGURES MATLAB allows graphs to be created quickly and conveniently. For example, to create a graph of the t and v arrays from the data previously, enter : >> plot (t, v) The graph appears in the graphic window and can be printed or transferred via the clipboard to other program. (Note: refers to your text book page 33 for illustrates the graph) You can customize/modify the graph a bit with commands such as : >> title ( plot of v versus t ) >> xlabel ( Values of t ) >> ylabel ( Values of v ) >> grid (Note: refers to your text book page 33 for illustrates your customized graph)
45 Table 2.2: Specifiers for colors, symbols and line types Colors Symbols Line Types Blue b Point. Solid - Green g Circle ο Dotted : Red r X-mark x Dashdot -. Cyan c Plus + Dashed - - Magenta m Star * Yellow y Square s Black k Diamond d Triangle (down) ᴠ Triangle (up) ᴧ Triangle (left) < Triangle (right) > Pentagon p Hexagram h
46 The plot command displays a solid line by default. If you want to plot each point with a symbol, you can include a specifier enclosed (Table 2.2) in single quotes in the plot function. For example; to plot with open cycle enter: >> plot (t, v, o ) MATLAB allows you to display more than one data set on the same plot. For example, to connect each date marker with a straight line: >> plot (t, v, t, v, o )
47 Note: by default, previous plots are erased every time the plot command is implemented. The hold on command holds the current plot and all axis properties so that additional graphing commands can be added to the existing plot. The hold off command returns to the default mode. For example, if we had typed the following commands, the final plot would only display symbols: >> plot (t, v,) >> plot (t, v, o ) In contrast, the following commands would result in both lines and symbols being displayed: >> plot (t, v,) >> hold on >> plot (t, v, o ) >> hold off
48 In addition to hold, another handy function is subplot, which allows you to split the graph window into subwindows or panels. Try to enter: >> subplot (m, n, p) This command break the graph window into an m-by-n matrix of small axes, and selects the p-th axes for the current plot.
49 We can demonstrate : subplot by examining MATLAB s capability to generate three-dimensional plots. The simplest manifestation of this capability is the plot3 command which has the syntax/sentence structure : >> t = 0 : pi/50 : 10*pi; >> subplot (1, 2, 1) ; plot (sin (t), cos (t)) >> axis square >> title ( (a) ) Fig. 2.1a shows the result is a circle. The circle is distorted if eliminates the axis square command.
50 How about if we want to add the helix shape to the graph s right pane/window. To do this, employ a parametric of, x = sin (t), y = cos (t) and z = 1 >> subplot (1, 2, 1) ; plot3 (sin (t), cos (t), (t)) >> title ( (b) ) Fig. 2.1b shows the result is a helix shape. Can you visualize what s going on? As time evolves, the x and y coordinates sketch out the circumference of the circle in the x-y plane in the same fashion as the two-dimension plot. However, simultaneously, the curve rises vertically as the z coordinate increase linearly with time. Thus, the result is the characteristic spring or spiral staircase shape of the helix.
51 3.6 OTHER RESOURCES 1) Excellent books devoted to MATLAB : Palm, 2005; Hanselman and Littlefield, 2005; Moore 2007) 2) Help facility can be assessed by clicking on the Help menu in the command window. This will provide with a number of different options for exploring and searching through MATLAB s Help material. 3) help command can be assessed by typing help command followed by the name of a command function as described previously. 4) lookfor command to find all functions related. For example to find all function relate to logarithms : >> lookfor logarithm MATLAB will display all references that include the word logarithm.
52 5) For further information click : You will find links product information, newsgroups, books, and technical support.
53 3.7 Case study : Exploratory/Examining Data Analysis We will use MATLAB s graphical capabilities to discern/distinguish patterns in the data for estimating drag coefficient, c d of a free-falling human based (equation 2.1) mg cd (2.1) 2 vt where, v t = terminal velocity (m/s) g = gravitational acceleration (m/s2) m = mass (kg) c d = drag coefficient (kg/m) v t thus gm c d
54 Solution: Input the data from Table 2.1 and gravitational acceleration in MATLAB command window as: >> m = [ ]; >> vt = [ ]; >> g = 9.81; The drag coefficient, c d can be computed with equation (2.1). Because calculation performing element-by-element operation on vector, we have include periods prior to the operation of MATLAB: >> cd = g*m./vt.^2 cd =
55 Then, use some of MATLAB s built-in function to generate some statistics results: >> cdavg = mean (cd), cdmin = min (cd), cdmax = max(cd) adavg = cdmin = cdmax = The result above shows that the average value is for a range from to kg/m Now, try using equation (2.1) to make prediction of the terminal velocity based on the average value of c d : >> vpred = sqrt (g*m/cdavg) Vpred =
56 Notice that no periods prior haven t used to the operation in this formula? Why? Try to plot these values versus the actual measured terminal velocities. Put command of superimpose a line indicating exact predictions (the 1:1 line) to help assess the results. As we need to generate a second plot, input the command subplot : >> subplot (2, 1, 1) ; plot (vt, vpred, o, vt, vt) >> xlabel ( measured ) >> ylabel ( predicted ) >> title ( Plot of predicted versus measured terminal velocities )
57 As in the top plot of Fig. 2.2, because the predictions generally follow the 1:1 line, you might initially conclude that the average drag coefficient yields decent results. However, notice how the mode tends to unpredict the low velocities and overpredict the high. This suggests that rather than being constant, there might be a trend in the drag coefficients. This can be seen by plotting the estimated drag coefficient versus mass as : >> subplot (2, 1, 2) ; plot (m, cd, o ) >> xlabel ( mass (kg) ) >> ylabel ( estimated drag coefficient (kg/m) ) >> title ( Plot of drag coefficient versus mass ) The resulting plot (bottom graph of Fig. 2.2), suggests that rather than being constant, the drag coefficient seems to be increasing as the mass of the jumper increases.
58 Based on this result, it might motivate you to conduct further experiments with a larger number of jumpers to confirm your preliminary/initial findings. Further investigates would discover that the parameter c d is actually a lumped/knob/collide drag coefficient that along with the true drag includes other factors such as the jumper s frontal area and air density, which discovers another formula for c d.
59 END OF CHAPTER 3 PART 1
PART 1 PROGRAMMING WITH MATHLAB
PART 1 PROGRAMMING WITH MATHLAB Presenter: Dr. Zalilah Sharer 2018 School of Chemical and Energy Engineering Universiti Teknologi Malaysia 23 September 2018 Programming with MATHLAB MATLAB Environment
More 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 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 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 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 information2 MATLAB Fundamentals
2 MATLAB Fundamentals CHAPTER OBJECTIVES The Knowledge primary and objective understanding of this chapter are prerequisites to provide for an the introduction effective implementation and overview of
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 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 informationPC-MATLAB PRIMER. This is intended as a guided tour through PCMATLAB. Type as you go and watch what happens.
PC-MATLAB PRIMER This is intended as a guided tour through PCMATLAB. Type as you go and watch what happens. >> 2*3 ans = 6 PCMATLAB uses several lines for the answer, but I ve edited this to save space.
More informationMatlab Introduction. Scalar Variables and Arithmetic Operators
Matlab Introduction Matlab is both a powerful computational environment and a programming language that easily handles matrix and complex arithmetic. It is a large software package that has many advanced
More 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 informationIntroduction to Matlab. By: Dr. Maher O. EL-Ghossain
Introduction to Matlab By: Dr. Maher O. EL-Ghossain Outline: q What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display Facilities Flow Control
More informationExperiment 1: Introduction to MATLAB I. Introduction. 1.1 Objectives and Expectations: 1.2 What is MATLAB?
Experiment 1: Introduction to MATLAB I Introduction MATLAB, which stands for Matrix Laboratory, is a very powerful program for performing numerical and symbolic calculations, and is widely used in science
More informationSome elements for Matlab programming
Some elements for Matlab programming Nathalie Thomas 2018 2019 Matlab, which stands for the abbreviation of MATrix LABoratory, is one of the most popular language for scientic computation. The classical
More informationMatlab 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 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 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 informationENGR Fall Exam 1
ENGR 1300 Fall 01 Exam 1 INSTRUCTIONS: Duration: 60 minutes Keep your eyes on your own work! Keep your work covered at all times! 1. Each student is responsible for following directions. Read carefully..
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 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 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 information2 Amazingly Simple Example Suppose we wanted to represent the following matrix 2 itchy = To enter itchy in Matla
Superlative-Laced Matlab Help for ECE155 Students Brian Kurkoski kurkoski@ucsd.edu October 13, 1999 This document is an introduction to Matlab for ECE155 students. It emphasizes the aspects of Matlab that
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 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 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 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 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 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 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 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 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 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 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 informationENGR Fall Exam 1
ENGR 13100 Fall 2012 Exam 1 INSTRUCTIONS: Duration: 60 minutes Keep your eyes on your own work! Keep your work covered at all times! 1. Each student is responsible for following directions. Read carefully.
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 informationMATLAB Tutorial Matrices & Vectors MATRICES AND VECTORS
MATRICES AND VECTORS A matrix (m x n) with m rows and n columns, a column vector (m x 1) with m rows and 1 column, and a row vector (1 x m) with 1 row and m columns all can be used in MATLAB. Matrices
More informationChapter 2 (Part 2) MATLAB Basics. dr.dcd.h CS 101 /SJC 5th Edition 1
Chapter 2 (Part 2) MATLAB Basics dr.dcd.h CS 101 /SJC 5th Edition 1 Display Format In the command window, integers are always displayed as integers Characters are always displayed as strings Other values
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 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
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 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 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 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 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 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 informationENGR Fall Exam 1 PRACTICE EXAM
ENGR 13100 Fall 2012 Exam 1 PRACTICE EXAM INSTRUCTIONS: Duration: 60 minutes Keep your eyes on your own work! Keep your work covered at all times! 1. Each student is responsible for following directions.
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 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 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 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 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 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 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 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 for Engineers, Third Edition
PowerPoint to accompany Introduction to MATLAB for Engineers, Third Edition William J. Palm III Chapter 2 Numeric, Cell, and Structure Arrays Copyright 2010. The McGraw-Hill Companies, Inc. This work is
More informationIntroduction to 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 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 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 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 informationIntroduction to MATLAB
Introduction to MATLAB 1 Introduction to MATLAB A Tutorial for the Course Computational Intelligence http://www.igi.tugraz.at/lehre/ci Stefan Häusler Institute for Theoretical Computer Science Inffeldgasse
More informationMATLAB 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 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 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 informationPhysics 326G Winter Class 2. In this class you will learn how to define and work with arrays or vectors.
Physics 326G Winter 2008 Class 2 In this class you will learn how to define and work with arrays or vectors. Matlab is designed to work with arrays. An array is a list of numbers (or other things) arranged
More 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 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 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 informationA/D Converter. Sampling. Figure 1.1: Block Diagram of a DSP System
CHAPTER 1 INTRODUCTION Digital signal processing (DSP) technology has expanded at a rapid rate to include such diverse applications as CDs, DVDs, MP3 players, ipods, digital cameras, digital light processing
More informationCITS2401 Computer Analysis & Visualisation
FACULTY OF ENGINEERING, COMPUTING AND MATHEMATICS CITS2401 Computer Analysis & Visualisation SCHOOL OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING Topic 3 Introduction to Matlab Material from MATLAB for
More 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 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 informationTable of Contents. Basis CEMTool 7 Tutorial
PREFACE CEMTool (Computer-aided Engineering & Mathematics Tool) is a useful computational tool in science and engineering. No matter what you background be it physics, chemistry, math, or engineering it
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 informationHow to learn MATLAB? Some predefined variables
ECE-S352 Lab 1 MATLAB Tutorial How to learn MATLAB? 1. MATLAB comes with good tutorial and detailed documents. a) Select MATLAB help from the MATLAB Help menu to open the help window. Follow MATLAB s Getting
More 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 informationIntroduction to MATLAB 7 for Engineers
PowerPoint to accompany Introduction to MATLAB 7 for Engineers William J. Palm III Chapter 2 Numeric, Cell, and Structure Arrays Copyright 2005. The McGraw-Hill Companies, Inc. Permission required for
More informationMAT 275 Laboratory 1 Introduction to MATLAB
MATLAB sessions: Laboratory 1 1 MAT 275 Laboratory 1 Introduction to MATLAB MATLAB is a computer software commonly used in both education and industry to solve a wide range of problems. This Laboratory
More 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 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 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 informationARRAY VARIABLES (ROW VECTORS)
11 ARRAY VARIABLES (ROW VECTORS) % Variables in addition to being singular valued can be set up as AN ARRAY of numbers. If we have an array variable as a row of numbers we call it a ROW VECTOR. You can
More informationSHAPE, SPACE & MEASURE
STAGE 1 Know the place value headings up to millions Recall primes to 19 Know the first 12 square numbers Know the Roman numerals I, V, X, L, C, D, M Know the % symbol Know percentage and decimal equivalents
More informationEE 350. Continuous-Time Linear Systems. Recitation 1. 1
EE 350 Continuous-Time Linear Systems Recitation 1 Recitation 1. 1 Recitation 1 Topics MATLAB Programming Basic Operations, Built-In Functions, and Variables m-files Graphics: 2D plots EE 210 Review Branch
More informationCourse Number 432/433 Title Algebra II (A & B) H Grade # of Days 120
Whitman-Hanson Regional High School provides all students with a high- quality education in order to develop reflective, concerned citizens and contributing members of the global community. Course Number
More informationEE 301 Signals & Systems I MATLAB Tutorial with Questions
EE 301 Signals & Systems I MATLAB Tutorial with Questions Under the content of the course EE-301, this semester, some MATLAB questions will be assigned in addition to the usual theoretical questions. This
More informationLab 1 Intro to MATLAB and FreeMat
Lab 1 Intro to MATLAB and FreeMat Objectives concepts 1. Variables, vectors, and arrays 2. Plotting data 3. Script files skills 1. Use MATLAB to solve homework problems 2. Plot lab data and mathematical
More information8.NS.1 8.NS.2. 8.EE.7.a 8.EE.4 8.EE.5 8.EE.6
Standard 8.NS.1 8.NS.2 8.EE.1 8.EE.2 8.EE.3 8.EE.4 8.EE.5 8.EE.6 8.EE.7 8.EE.7.a Jackson County Core Curriculum Collaborative (JC4) 8th Grade Math Learning Targets in Student Friendly Language I can identify
More informationPRE-ALGEBRA PREP. Textbook: The University of Chicago School Mathematics Project. Transition Mathematics, Second Edition, Prentice-Hall, Inc., 2002.
PRE-ALGEBRA PREP Textbook: The University of Chicago School Mathematics Project. Transition Mathematics, Second Edition, Prentice-Hall, Inc., 2002. Course Description: The students entering prep year have
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 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 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 informationMaths. Formative Assessment/key piece of work prior to end of unit: Term Autumn 1
Term Autumn 1 3 weeks Negative numbers Multiples and factors Common factors Prime numbers Ordering decimal numbers Rounding Square numbers and square roots Prime factor decomposition LCM and HCF Square
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 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 informationLab #1 Revision to MATLAB
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
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
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 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 informationHomework 1 Description CmpE 362 Spring Instructor : Fatih Alagoz Teaching Assistant : Yekta Said Can Due: 3 March, 23:59, sharp
Homework 1 Description CmpE 362 Spring 2016 Instructor : Fatih Alagoz Teaching Assistant : Yekta Said Can Due: 3 March, 23:59, sharp Homework 1 This homework is designed to teach you to think in terms
More information