The word dice. Historically, dice is the plural of die. In modern standard English, dice is used as both the singular and the plural.
|
|
- Laura Barnett
- 5 years ago
- Views:
Transcription
1 The word dice Historically, dice is the plural of die. In modern standard English, dice is used as both the singular and the plural. 52 Example of 19th Century bone dice
2 Advanced dice 53 [ ]
3 randi function We have already seen the rand and randn functions. Generate uniformly distributed pseudorandom integers randi(imax) returns a scalar value between 1 and imax. randi(imax,m,n) and randi(imax,[m,n]) return an m-by-n matrix containing pseudorandom integer values drawn from the discrete uniform distribution on the interval [1,imax]. randi(imax) is the same as randi(imax,1). randi([imin,imax],...) returns an array containing integer values drawn from the discrete uniform distribution on the interval [imin,imax]. 54
4 randi function: Example LLN_cointoss.m close all; clear all; N = 1e3; % Number of trials (number of times that the coin is tossed) s = (rand(1,n) < 0.5); % Generate a sequence of N Coin Tosses. % The results are saved in a row vector s. NH = cumsum(s); % Count the number of heads plot(nh./(1:n)) % Plot the relative frequencies Same as randi([0,1],1,n); 55
5 Dice Simulator Support up to 6 dice and also has some background information on dice and random numbers. 56
6 57 Two Dice
7 58 Two-Dice Statistics
8 Classical Probability Assumptions The number of possible outcomes is finite. Equipossibility: The outcomes have equal probability of occurrence. Equi-possible; equi-probable; euqally likely; fair The bases for identifying equipossibility were often physical symmetry (e.g. a well-balanced die, made of homogeneous material in a cubical shape) a balance of information or knowledge concerning the various possible outcomes. Formula: A probability is a fraction in which the bottom represents the number of possible outcomes, while the number on top represents the number of outcomes in which the event of interest occurs. 59
9 Two Dice A pair of dice 60 Double six
10 Two dice: Simulation [ ] 61
11 Two dice Assume that the two dice are fair and independent. P[sum of the two dice = 5] = 4/36 62
12 Two dice Assume that the two dice are fair and independent. 63
13 64 Two-Dice Statistics
14 Leibniz s Error (1768) Though one of the finest minds of his age, Leibniz was not immune to blunders: he thought it just as easy to throw 12 with a pair of dice as to throw 11. The truth is P[sum of the two dice = 11] P[sum of the two dice = 12] Leibniz is a German philosopher, mathematician, and statesman who developed differential and integral calculus independently of Isaac Newton. 65 [Gorroochurn, 2012]
15 Two dice: MATLAB Simulation n = 1e3; Number_Dice = 2; D = randi([1,6],number_dice,n); S = sum(d); % sum along each column RF11 = cumsum(s==11)./(1:n); plot(1:n,rf11) hold on RF12 = cumsum(s==12)./(1:n); plot(1:n,rf12,'r') [SumofTwoDice.m] 66
16 Concatenation Concatenation is the process of joining arrays to make larger ones. The pair of square brackets [] is the concatenation operator. Horizontal concatenation: Concatenate arrays horizontally using commas. Each array must have the same number of rows. Vertical concatenation: Concatenate arrays vertically using semicolons. The arrays must have the same number of columns. 67
17 More on plot: Line specification Various line types (styles), plot symbols (markers) and colors may be obtained with plot(x,y,s) where S is a character string made from one element from any or all the following 3 columns: 68 y yellow. point - solid m magenta o circle : dotted c cyan x x-mark -. dashdot r red + plus -- dashed g green * star b blue s square w white k black d diamond v triangle (down) ^ triangle (up) < triangle (left) > triangle (right) p pentagram h hexagram
18 Character Strings A character string is a sequence of any number of characters enclosed in single quotes. If the text includes a single quote, use two single quotes within the definition. These sequences are arrays, like all MATLAB variables. Their class or data type is char, which is short for character. You can concatenate strings with square brackets, just as you concatenate numeric arrays. To convert numeric values to strings, use functions, such as num2str or int2str. 69
19 More on plot : Examples PLOT(X,Y,'c+:')plo ts a cyan dotted line with a plus at each data point PLOT(X,Y,'bd')plots blue diamond at each data point but does not draw any line
20 More on plot : Axes and Title x = linspace(0,10,100); y1 = sin(x); y2 = cos(x); plot(x,y1,'mo--',x,y2,'bs--') title('sin and cos functions') xlabel('x') ylabel('y') legend('y = sin(x)','y = cos(x)') grid on y sin and cos functions y = sin(x) y = cos(x) x 71
21 Two dice: MATLAB Simulation n = 1e3; Number_Dice = 2; D = randi([1,6],number_dice,n); S = sum(d); % sum along each column RF11 = cumsum(s==11)./(1:n); plot(1:n,rf11) hold on RF12 = cumsum(s==12)./(1:n); plot(1:n,rf12,'r') Relative Frequency Sum = 11 Sum = 12 xlabel('number of Rolls') ylabel('relative Frequency') legend('sum = 11', 'Sum = 12') grid on figure S_Support = (1*Number_Dice):(6*Number_Dice); hist(s,s_support) Number of Rolls N_S_Sim = hist(s,s_support); [SumofTwoDice.m]
22 Loops Loops are MATLAB constructs that permit us to execute a sequence of statements more than once. There are two basic forms of loop constructs: while loops and for loops. The major difference between these two types of loops is in how the repetition is controlled. The code in a while loop is repeated an indefinite number of times until some user-specified condition is satisfied. By contrast, the code in a for loop is repeated a specified number of times, and the number of repetitions is known before the loops starts. 73
23 for loop: a preview 74 Execute a block of statements a specified number of times. for end k = expr body for_ex1.m for k = 1:5 x = k end k is the loop variable (also known as the loop index or iterator variable). expr is the loop control expression, whose result usually takes the form of a vector. The elements in the vector are stored one at a time in the variable k, and then the loop body is executed, so that the loop is executed once for each element in the array produced by expr. The statements between the for statement and the end statement are known as the body of the loop. They are executed repeatedly during each pass of the for loop.
24 Two dice: Probability Calculation Generate all the 36 possibilities. Find the corresponding sum. Count how many, among the 36, have a particular value. Number_Dice = 2; Dice_Support = 1:6; S_Support = (1*Number_Dice):(6*Number_Dice); S = []; for k1 = Dice_Support for k2 = Dice_Support S = [S k1+k2]; end end Size_SampleSpace = length(s); Number_11 = sum(s==11) Number_12 = sum(s==12) % Count all possible cases at once N_S = hist(s,s_support) P = sym(n_s)/size_samplespace Nested loops Concatenation 75
25 Vectorization and Preallocation Revisiting an old script: close all; clear all; N = 1e3; % Number of trials (number of times that the coin is tossed) s = randi([0,1],1,n); % Generate a sequence of N Coin Tosses. % The results are saved in a row vector s. NH = cumsum(s); % Count the number of heads plot(nh./(1:n)) % Plot the relative frequencies LLN_cointoss.m close all; clear all; N = 1e3; % Number of trials s = zeros(1,n); % Preallocation s(1) = randi([0,1]); for k = 2:N s(k) = randi([0,1]); end The script will still run without this line. NH = cumsum(s); % Count the number of heads plot(nh./(1:n)) % Plot relative frequencies LLN_cointoss_for_preallocated.m 76
26 Preallocating Vectors (or Arrays) Used when the content of a vector is computed/added/known while the loop is executed. One method is to start with an empty vector and extend the vector by adding each number to it as the numbers are computed. Inefficient. Every time a vector is extended a new chunk of memory must be found that is large enough for the new vector, and all of the values must be copied from the original location in memory to the new one. This can take a long time. A better method is to preallocate the vector to the correct size and then change the value of each element to store the desired value. This method involves referring to each index in the output vector, and placing each number into the next element in the output vector. This method is far superior, if it is known ahead of time how many elements the vector will have. One common method is to use the zeros function to preallocate the vector to the correct length. 77
27 zeros, ones, eye zeros Create array of all zeros. zeros returns the scalar 0. zeros(n) returns an n-by-n matrix of zeros. zeros(n,m) returns an n-by-m matrix of zeros. ones Create array of all ones. eye Create identity matrix. eye returns the scalar, 1. eye(n) returns an n-by-n identity matrix with ones on the main diagonal and zeros elsewhere. eye(n,m) returns an n-by-m matrix with ones on the main diagonal and zeros elsewhere. 78
28 Exercise The following script was used to calculate the probabilities related to the sum resulting from a roll of two dice. Modify the script here so that the vector S is preallocated. Modify the script to also create a matrix SS. Its size is 6 6. The value of its (k1,k2) element should be k1+k2. Number_Dice = 2; Dice_Support = 1:6; S_Support = (1*Number_Dice):(6*Number_Dice); S = []; for k1 = Dice_Support for k2 = Dice_Support S = [S k1+k2]; end end Size_SampleSpace = length(s); Number_11 = sum(s==11) Number_12 = sum(s==12) % Count all possible cases at once N_S = hist(s,s_support) P = sym(n_s)/size_samplespace 79
29 Galileo and the Duke of Tuscany (1620) [Gorroochurn, 2012] When you toss three dice, the chance of the sum being 10 is greater than the chance of the sum being 9. The Grand Duke of Tuscany ordered Galileo to explain a paradox arising in the experiment of tossing three dice: Why, although there were an equal number of 6 partitions of the numbers 9 and 10, did experience state that the chance of throwing a total 9 with three fair dice was less than that of throwing a total of 10? Partitions of sums 11, 12, 9 and 10 of the game of three fair dice: 80
30 Exercise Sum = 11 Sum = 12 Write a MATLAB script to Simulate N = 1000 repeated rolls of three dices. Calculate the sum of the three dices from the rolls above. Plot the relative frequency for the event that the sum is 9. In the same figure, plot (in red) the relative frequency for the event that the sum is 10. In another figure, create a histogram for the sum after N rolls of three dice. Calculate the actual probability for each possible value of the sum. In another figure, compare the probability with the relative frequency obtained after the N simulations. Relative Frequency Number of Rolls probability relative frequency sum of three dice 81
31 Three-Dimensional Arrays Arrays in MATLAB are not limited to two dimensions. 82
32 Three-Dimensional Arrays Three-dimensional arrays can be created directly using functions such as the zeros, ones, rand, and randi functions by specifying three dimensions to begin with. For example, zeros(4,3,2) will create a matrix of all 0s. 83
33 Empty Array 84 An array that stores no value Created using empty square brackets: [] Values can then be added by concatenating. Can be used to delete elements from vectors or matrices. Individual elements cannot be removed from matrices. Matrices always have to have the same number of elements in every row. Entire rows or columns could be removed from a matrix.
34 Scandal of Arithmetic Which is more likely, obtaining at least one six in 4 tosses of a fair dice (event A), or obtaining at least one double six in 24 tosses of a pair of dice (event B)? PA ( ) PB ( ) [
35 Origin of Probability Theory Probability theory was originally inspired by gambling problems. In 1654, Chevalier de Méré invented a gambling system which bet even money on case B. When he began losing money, he asked his mathematician friend Blaise Pascal to analyze his gambling system. Pascal discovered that the Chevalier's system would lose about 51 percent of the time. Pascal became so interested in probability and together with another famous mathematician, Pierre de Fermat, they laid the foundation of probability theory. 86 best known for Fermat's Last Theorem
36 Branching Statements: if statement General form: if expression statements elseif expression statements else statements end The ELSE and ELSEIF parts are optional. The statements are executed if the real part of the expression has all non-zero elements. Zero or more ELSEIF parts can be used as well as nested if s. The expression usually contains ==, <, >, <=, >=, or ~=. 87
37 Example: Assigning Grades Pass vs. Fail if_ex_1.m % Generate a random number score = randi(100, 1) if score >= 50 grade = 'pass' else grade = 'fail' end true score 50 false grade = pass grade = fail 88
38 Example: Assigning Letter Grades true grade = A score 80 true false score 70 % Generate a random number score = randi(100, 1) if score >= 80 grade = 'A' elseif score >= 70 grade = 'B' elseif score >= 60 grade = 'C' elseif score >= 50 grade = 'D' else grade = 'F' end false grade = B true score 60 false grade = C true score 50 false 89 grade = D grade = F
39 Exercise Write a MATLAB script to evaluate the relative frequencies involved in the scandal of arithmetic Event A: At least one six in 4 tosses of a fair dice Event B: At least one double six in 24 tosses of a pair of dice 0.6 relative frequency number of rolls
40 Exercise Write a MATLAB script to evaluate the relative frequencies involved in the Monty Hall game Not Switch Swicth 0.8 Relative Frequency of Winning Number of Trials
Mechanical 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 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 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 informationProbability and Random Processes ECS 315
Probability and Random Processes ECS 315 1 Asst. Prof. Dr. Prapun Suksompong prapun@siit.tu.ac.th Working with Randomness using MATLAB Office Hours: BKD, 4th floor of Sirindhralai building Monday 9:30-10:30
More informationMATLAB SUMMARY FOR MATH2070/2970
MATLAB SUMMARY FOR MATH2070/2970 DUNCAN SUTHERLAND 1. Introduction The following is inted as a guide containing all relevant Matlab commands and concepts for MATH2070 and 2970. All code fragments should
More 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 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 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 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 informationDSP Laboratory (EELE 4110) Lab#1 Introduction to Matlab
Islamic University of Gaza Faculty of Engineering Electrical Engineering Department 2012 DSP Laboratory (EELE 4110) Lab#1 Introduction to Matlab Goals for this Lab Assignment: In this lab we would have
More informationComputer Programming in MATLAB
Computer Programming in MATLAB Prof. Dr. İrfan KAYMAZ Engineering Faculty Department of Mechanical Engineering Arrays in MATLAB; Vectors and Matrices Graphing Vector Generation Before graphing plots in
More 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 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 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 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 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
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 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 informationThis module aims to introduce Precalculus high school students to the basic capabilities of Matlab by using functions. Matlab will be used in
This module aims to introduce Precalculus high school students to the basic capabilities of Matlab by using functions. Matlab will be used in subsequent modules to help to teach research related concepts
More 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 informationGraphics and plotting techniques
Davies: Computer Vision, 5 th edition, online materials Matlab Tutorial 5 1 Graphics and plotting techniques 1. Introduction The purpose of this tutorial is to outline the basics of graphics and plotting
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 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. 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 informationMATLAB Guide to Fibonacci Numbers
MATLAB Guide to Fibonacci Numbers and the Golden Ratio A Simplified Approach Peter I. Kattan Petra Books www.petrabooks.com Peter I. Kattan, PhD Correspondence about this book may be sent to the author
More 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 informationMATLAB Modul 2. Introduction to Computational Science: Modeling and Simulation for the Sciences, 2 nd Edition
MATLAB Modul 2 Introduction to Computational Science: Modeling and Simulation for the Sciences, 2 nd Edition Angela B. Shiflet and George W. Shiflet Wofford College 2014 by Princeton University Press Introduction
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 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 informationIntroduction to Scientific Programming in MATLAB
Introduction to Scientific Programming in MATLAB Derrick Kearney HUBzero Platform for Scientific Collaboration Purdue University Original slides by Michael McLennan This work licensed under Creative Commons
More informationMath 375 Natalia Vladimirova (many ideas, examples, and excersises are borrowed from Profs. Monika Nitsche, Richard Allen, and Stephen Lau)
Natalia Vladimirova (many ideas, examples, and excersises are borrowed from Profs. Monika Nitsche, Richard Allen, and Stephen Lau) January 24, 2010 Starting Under windows Click on the Start menu button
More informationMATLAB Modul 4. Introduction
MATLAB Modul 4 Introduction to Computational Science: Modeling and Simulation for the Sciences, 2 nd Edition Angela B. Shiflet and George W. Shiflet Wofford College 2014 by Princeton University Press Introduction
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 informationBasic Graphs. Dmitry Adamskiy 16 November 2011
Basic Graphs Dmitry Adamskiy adamskiy@cs.rhul.ac.uk 16 November 211 1 Plot Function plot(x,y): plots vector Y versus vector X X and Y must have the same size: X = [x1, x2 xn] and Y = [y1, y2,, yn] Broken
More 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 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 informationfplot Syntax Description Examples Plot Symbolic Expression Plot symbolic expression or function fplot(f) fplot(f,[xmin xmax])
fplot Plot symbolic expression or function Syntax fplot(f) fplot(f,[xmin xmax]) fplot(xt,yt) fplot(xt,yt,[tmin tmax]) fplot(,linespec) fplot(,name,value) fplot(ax, ) fp = fplot( ) Description fplot(f)
More information2009 Fall Startup Event Thursday, September 24th, 2009
009 Fall Startup Event This test consists of 00 problems to be solved in 0 minutes. All answers must be exact, complete, and in simplest form. To ensure consistent grading, if you get a decimal, mixed
More informationPurpose of the lecture MATLAB MATLAB
Purpose of the lecture MATLAB Harri Saarnisaari, Part of Simulations and Tools for Telecommunication Course This lecture contains a short introduction to the MATLAB For further details see other sources
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 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 informationThe Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development
The Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development Chapter 7 Graphics Learning outcomes Label your plots Create different
More informationDr Richard Greenaway
SCHOOL OF PHYSICS, ASTRONOMY & MATHEMATICS 4PAM1008 MATLAB 4 Visualising Data Dr Richard Greenaway 4 Visualising Data 4.1 Simple Data Plotting You should now be familiar with the plot function which is
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 informationINC151 Electrical Engineering Software Practice. MATLAB Graphics. Dr.Wanchak Lenwari :Control System and Instrumentation Engineering, KMUTT 1
INC151 Electrical Engineering Software Practice MATLAB Graphics Dr.Wanchak Lenwari :Control System and Instrumentation Engineering, KMUTT 1 Graphical display is one of MATLAB s greatest strengths and most
More 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 informationPROGRAMMING WITH MATLAB WEEK 6
PROGRAMMING WITH MATLAB WEEK 6 Plot: Syntax: plot(x, y, r.- ) Color Marker Linestyle The line color, marker style and line style can be changed by adding a string argument. to select and delete lines
More 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 informationComputational Finance
Computational Finance Introduction to Matlab Marek Kolman Matlab program/programming language for technical computing particularly for numerical issues works on matrix/vector basis usually used for functional
More informationMATLAB PROGRAMMING LECTURES. By Sarah Hussein
MATLAB PROGRAMMING LECTURES By Sarah Hussein Lecture 1: Introduction to MATLAB 1.1Introduction MATLAB is a mathematical and graphical software package with numerical, graphical, and programming capabilities.
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 information1 Introduction to MATLAB
1 Introduction to MATLAB 1.1 General considerations The aim of this laboratory is to review some useful MATLAB commands in digital signal processing. MATLAB is one of the fastest and most enjoyable ways
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 informationCSE/NEUBEH 528 Homework 0: Introduction to Matlab
CSE/NEUBEH 528 Homework 0: Introduction to Matlab (Practice only: Do not turn in) Okay, let s begin! Open Matlab by double-clicking the Matlab icon (on MS Windows systems) or typing matlab at the prompt
More informationLecture 15 MATLAB II: Conditional Statements and Arrays
Lecture 15 MATLAB II: Conditional Statements and Arrays 1 Conditional Statements 2 The boolean operators in MATLAB are: > greater than < less than >= greater than or equals
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 informationJME Language Reference Manual
JME Language Reference Manual 1 Introduction JME (pronounced jay+me) is a lightweight language that allows programmers to easily perform statistic computations on tabular data as part of data analysis.
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 informationClasses 7-8 (4 hours). Graphics in Matlab.
Classes 7-8 (4 hours). Graphics in Matlab. Graphics objects are displayed in a special window that opens with the command figure. At the same time, multiple windows can be opened, each one assigned a number.
More informationMATLAB primer for CHE 225
MATLAB primer for CHE 225 The following pages contain a brief description of the MATLAB features are used in CHE 225. This document is best used in conjunction with the MATLAB codes posted on Vista. Find
More informationTOPIC 6 Computer application for drawing 2D Graph
YOGYAKARTA STATE UNIVERSITY MATHEMATICS AND NATURAL SCIENCES FACULTY MATHEMATICS EDUCATION STUDY PROGRAM TOPIC 6 Computer application for drawing 2D Graph Plotting Elementary Functions Suppose we wish
More informationIntroduction to Matlab
NDSU Introduction to Matlab pg 1 Becoming familiar with MATLAB The console The editor The graphics windows The help menu Saving your data (diary) Solving N equations with N unknowns Least Squares Curve
More informationMatlab Tutorial. The value assigned to a variable can be checked by simply typing in the variable name:
1 Matlab Tutorial 1- What is Matlab? Matlab is a powerful tool for almost any kind of mathematical application. It enables one to develop programs with a high degree of functionality. The user can write
More 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 information13-5. Pascal s Triangle. Vocabulary. Pascal s Triangle. Lesson. Mental Math
Lesson 3-5 Pascal s Triangle Vocabulary Pascal s Triangle BIG IDEA The nth row of Pascal s Triangle contains the number of ways of choosing r objects out of n objects without regard to their order, that
More informationVectors and Matrices. Chapter 2. Linguaggio Programmazione Matlab-Simulink (2017/2018)
Vectors and Matrices Chapter 2 Linguaggio Programmazione Matlab-Simulink (2017/2018) Matrices A matrix is used to store a set of values of the same type; every value is stored in an element MATLAB stands
More informationGrade 6 Number Strand
Grade 6 Number Strand Outcome 6.N.1. Demonstrate an understanding of place value for numbers greater than one million less than one thousandth [C, CN, R, T] 6.N.2. Solve problems involving large numbers,
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 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 informationMCAS/DCCAS Mathematics Correlation Chart Grade 6
MCAS/DCCAS Mathematics Correlation Chart Grade 6 MCAS Finish Line Mathematics Grade 6 MCAS Standard DCCAS Standard DCCAS Standard Description Unit 1: Number Sense Lesson 1: Whole Number and Decimal Place
More informationIntroduction to Matlab. By: Hossein Hamooni Fall 2014
Introduction to Matlab By: Hossein Hamooni Fall 2014 Why Matlab? Data analytics task Large data processing Multi-platform, Multi Format data importing Graphing Modeling Lots of built-in functions for rapid
More informationA General Introduction to Matlab
Master Degree Course in ELECTRONICS ENGINEERING http://www.dii.unimore.it/~lbiagiotti/systemscontroltheory.html A General Introduction to Matlab e-mail: luigi.biagiotti@unimore.it http://www.dii.unimore.it/~lbiagiotti
More informationIntroduction To MATLAB Introduction to Programming GENG 200
Introduction To MATLAB Introduction to Programming GENG 200, Prepared by Ali Abu Odeh 1 Table of Contents M Files 2 4 2 Execution Control 3 Vectors User Defined Functions Expected Chapter Duration: 6 classes.
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 informationMAT 275 Laboratory 2 Matrix Computations and Programming in MATLAB
MATLAB sessions: Laboratory MAT 75 Laboratory Matrix Computations and Programming in MATLAB In this laboratory session we will learn how to. Create and manipulate matrices and vectors.. Write simple programs
More informationMATLAB GUIDE UMD PHYS401 SPRING 2011
MATLAB GUIDE UMD PHYS401 SPRING 2011 Note that it is sometimes useful to add comments to your commands. You can do this with % : >> data=[3 5 9 6] %here is my comment data = 3 5 9 6 At any time you can
More informationMonte Carlo Techniques. Professor Stephen Sekula Guest Lecture PHY 4321/7305 Sep. 3, 2014
Monte Carlo Techniques Professor Stephen Sekula Guest Lecture PHY 431/7305 Sep. 3, 014 What are Monte Carlo Techniques? Computational algorithms that rely on repeated random sampling in order to obtain
More informationOverview. Lecture 13: Graphics and Visualisation. Graphics & Visualisation 2D plotting. Graphics and visualisation of data in Matlab
Overview Lecture 13: Graphics and Visualisation Graphics & Visualisation 2D plotting 1. Plots for one or multiple sets of data, logarithmic scale plots 2. Axis control & Annotation 3. Other forms of 2D
More informationA MATLAB Exercise Book. Ludmila I. Kuncheva and Cameron C. Gray
A MATLAB Exercise Book Ludmila I. Kuncheva and Cameron C. Gray Contents 1 Getting Started 1 1.1 MATLAB................................................. 1 1.2 Programming Environment......................................
More information% Close all figure windows % Start figure window
CS1112 Fall 2016 Project 3 Part A Due Monday 10/3 at 11pm You must work either on your own or with one partner. If you work with a partner, you must first register as a group in CMS and then submit your
More information(Creating Arrays & Matrices) Applied Linear Algebra in Geoscience Using MATLAB
Applied Linear Algebra in Geoscience Using MATLAB (Creating Arrays & Matrices) Contents Getting Started Creating Arrays Mathematical Operations with Arrays Using Script Files and Managing Data Two-Dimensional
More informationLoop Statements and Vectorizing Code
CHAPTER 5 Loop Statements and Vectorizing Code KEY TERMS looping statements counted loops conditional loops action vectorized code iterate loop or iterator variable echo printing running sum running product
More informationToday s topics. Announcements/Reminders: Characters and strings Review of topics for Test 1
Today s topics Characters and strings Review of topics for Test 1 Announcements/Reminders: Assignment 1b due tonight 11:59pm Test 1 in class on Thursday Characters & strings We have used strings already:
More informationModeling RNA/DNA with Matlab - Chemistry Summer 2007
Modeling RNA/DNA with Matlab - Chemistry 694 - Summer 2007 If you haven t already, download MatlabPrograms.zip from the course Blackboard site and extract all the files into a folder on your disk. Be careful
More informationMathematics Year 9-11 Skills and Knowledge Checklist. Name: Class: Set : Premier Date Year 9 MEG :
Personal targets to help me achieve my grade : AFL Sheet Number 1 : Standard Form, Decimals, Fractions and Percentages Standard Form I can write a number as a product of it s prime factors I can use the
More informationDistributions of Continuous Data
C H A P T ER Distributions of Continuous Data New cars and trucks sold in the United States average about 28 highway miles per gallon (mpg) in 2010, up from about 24 mpg in 2004. Some of the improvement
More information7 Control Structures, Logical Statements
7 Control Structures, Logical Statements 7.1 Logical Statements 1. Logical (true or false) statements comparing scalars or matrices can be evaluated in MATLAB. Two matrices of the same size may be compared,
More informationMATLAB Operators, control flow and scripting. Edited by Péter Vass
MATLAB Operators, control flow and scripting Edited by Péter Vass Operators An operator is a symbol which is used for specifying some kind of operation to be executed. An operator is always the member
More informationIntroduction to Matlab
Introduction to Matlab Enrique Muñoz Ballester Dipartimento di Informatica via Bramante 65, 26013 Crema (CR), Italy enrique.munoz@unimi.it Contact Email: enrique.munoz@unimi.it Office: Room BT-43 Industrial,
More informationGraphics Example a final product:
Basic 2D Graphics 1 Graphics Example a final product: TITLE LEGEND YLABEL TEXT or GTEXT CURVES XLABEL 2 2-D Plotting Specify x-data and/or y-data Specify color, line style and marker symbol (Default values
More informationegrapher Language Reference Manual
egrapher Language Reference Manual Long Long: ll3078@columbia.edu Xinli Jia: xj2191@columbia.edu Jiefu Ying: jy2799@columbia.edu Linnan Wang: lw2645@columbia.edu Darren Chen: dsc2155@columbia.edu 1. Introduction
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 informationA Framework for Achieving the Essential Academic Learning. Requirements in Mathematics Grades 8-10 Glossary
A Framework for Achieving the Essential Academic Learning Requirements in Mathematics Grades 8-10 Glossary absolute value the numerical value of a number without regard to its sign; the distance of the
More informationIntroduction to Matlab
Introduction to Matlab November 22, 2013 Contents 1 Introduction to Matlab 1 1.1 What is Matlab.................................. 1 1.2 Matlab versus Maple............................... 2 1.3 Getting
More informationMathematics - LV 6 Correlation of the ALEKS course Mathematics MS/LV 6 to the Massachusetts Curriculum Framework Learning Standards for Grade 5-6
Mathematics - LV 6 Correlation of the ALEKS course Mathematics MS/LV 6 to the Massachusetts Curriculum Framework Learning Standards for Grade 5-6 Numbers Sense and Operations TD = Teacher Directed 6.N.1:
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 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 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 informationPractical 4: The Integrate & Fire neuron
Practical 4: The Integrate & Fire neuron 2014 version by Mark van Rossum 2018 version by Matthias Hennig and Theoklitos Amvrosiadis 16th October 2018 1 Introduction to MATLAB basics You can start MATLAB
More informationIntroduction and MATLAB Basics
Introduction and MATLAB Basics Lecture Computer Room MATLAB MATLAB: Matrix Laboratory, designed for matrix manipulation Pro: Con: Syntax similar to C/C++/Java Automated memory management Dynamic data types
More information