Recap Script M-file Editor/Debugger Window Cell Mode Chapter 3 “Built in MATLAB Function” Using Built-in Functions Using the HELP Feature Window HELP.

Slides:



Advertisements
Similar presentations
Chapter 2 Section 2. Lemma Let i=1 and j=2, then.
Advertisements

Introduction to Matlab
A MATLAB function is a special type of M-file that runs in its own independent workspace. It receives input data through an input argument list, and returns.
Managerial Decision Making and Problem Solving Computer Lab Notes 1.
Slides 2c: Using Spreadsheets for Modeling - Excel Concepts (Updated 1/19/2005) There are several reasons for the popularity of spreadsheets: –Data are.
CMPS 1371 Introduction to Computing for Engineers FUNCTIONS.
Random variables 1. Note  there is no chapter in the textbook that corresponds to this topic 2.
Slide deck by Dr. Greg Reese Miami University MATLAB An Introduction With Applications, 5 th Edition Dr. Amos Gilat The Ohio State University Chapter 3.
Q UIZ Direction: Choose the correct answer from the given choices. Begin.
Lecture 6 MATLAB functions Basics of Built-in Functions, Help Feature, Elementary Functions (e.g., Polynomials, Trigonometric Functions), Data Analysis,
Lecture 4 Sept 8 Complete Chapter 3 exercises Chapter 4.
EGR 106 – Week 2 – Arrays Definition, size, and terminology Construction methods Addressing and sub-arrays Some useful functions for arrays Character arrays.
Chapter 2 Section 1 Solving a System of Linear Equations (using Matrices)
Part 4 Chapter 13 Linear Regression
General Computer Science for Engineers CISC 106 Lecture 08 Dr. John Cavazos Computer and Information Sciences 2/27/2009.
Introduction to Simulation. What is simulation? A simulation is the imitation of the operation of a real-world system over time. It involves the generation.
Communication Systems Simulation - III Harri Saarnisaari Part of Simulations and Tools for Telecommunication Course.
C ENTER FOR I NTEGRATED R ESEARCH C OMPUTING MATLAB
Lecture 4 Sept 7 Chapter 4. Chapter 4 – arrays, collections and indexing This chapter discusses the basic calculations involving rectangular collections.
Matrix Mathematics in MATLAB and Excel
Introduction to Array The fundamental unit of data in any MATLAB program is the array. 1. An array is a collection of data values organized into rows and.
Excel For MATH 125 Computing Statistics. Useful link Surfstat: (an online text in introductory Statistics)
1 MATLAB 基礎. 2 MATLAB  Workspace: environment (address space) where all variables reside  After carrying out a calculation, MATLAB assigns the result.
Portfolio Statistics  Portfolio Expected Return: E(r p ) = w T r  Portfolio Variance:  2 p = w T  w  Sum of portfolio weights: = w T 1 –where w is.
Computer Programming (TKK-2144) 13/14 Semester 1 Instructor: Rama Oktavian Office Hr.: M.13-15, W Th , F
Chapter 5. Loops are common in most programming languages Plus side: Are very fast (in other languages) & easy to understand Negative side: Require a.
Matlab tutorial course Lesson 2: Arrays and data types
Array Math.
Martin Ellison University of Warwick and CEPR Bank of England, December 2005 Introduction to MATLAB.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
Introduction to MATLAB
Recap Graphic Window Edit Window Start Button Matrices in MATLAB Scalar Operations Order of Operations Array Operations Matrix Addition Matrix Multiplication.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 6 Value- Returning Functions and Modules.
Calculating Statistics in Microsoft Excel Click on the type of statistic you would like to create. If you need to learn how to round your answers, click.
Introduction to MATLAB CBE 502 Mathematical Methods of Engineering Analysis.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
MATLAB An Introduction to MATLAB (Matrix Laboratory) 1.
Matlab for Engineers Built-in Matlab Functions Chapter 3.
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (1): Introduction.
CMPS 1371 Introduction to Computing for Engineers MATRICES.
Introduction to MATLAB 7 Engineering 161 Engineering Practices II Joe Mixsell Spring 2010.
Matlab for Engineers Manipulating Matlab Matrices Chapter 4.
Recap Sum and Product Functions Matrix Size Function Variance and Standard Deviation Random Numbers Complex Numbers.
Chapter 3 MATLAB Fundamentals Introduction to MATLAB Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
ES 240: Scientific and Engineering Computation. Chapter 2 Chapter 2: MATLAB Fundamentals Uchechukwu Ofoegbu Temple University.
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
Chapter 6 Review: User Defined Functions Introduction to MATLAB 7 Engineering 161.
Matlab Screen  Command Window  type commands  Current Directory  View folders and m-files  Workspace  View program variables  Double click on a.
Lec-10 Manipulations of Matlab Matrices. Built-in functions The chapter will be covered quickly There are quite a few built-in functions in MATLAB – If.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2: Methods and Data Programming with Alice and Java First Edition.
Risk Analysis Simulate a scenario of possible input values that could occur and observe key impacts Pick many input scenarios according to their likelihood.
PERFORMING CALCULATIONS Microsoft Excel. Excel Formulas A formula is a set of mathematical instructions that can be used in Excel to perform calculations.
Array Creation ENGR 1187 MATLAB 2. Today’s Topics  Arrays: What are they?  Vectors  Matrices  Creating Arrays.
Introduction to Engineering MATLAB – 4 Arrays Agenda Creating arrays of numbers  Vectors: 1-D Arrays  Arrays: 2-D Arrays Array Addressing Strings & String.
Introduction to MATLAB 1.Basic functions 2.Vectors, matrices, and arithmetic 3.Flow Constructs (Loops, If, etc) 4.Create M-files 5.Plotting.
1 Lecture 3 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
1 An Introduction to R © 2009 Dan Nettleton. 2 Preliminaries Throughout these slides, red text indicates text that is typed at the R prompt or text that.
Lecture 24: Rough and Ready Analysis. MATLAB uses function names consistent with most major programming languages For example sqrt sin cos log.
SCRIPTS AND FUNCTIONS DAVID COOPER SUMMER Extensions MATLAB has two main extension types.m for functions and scripts and.mat for variable save files.
 Solve the equation.  1.) 3x = 23  2.) 2(x + 7) 2 = 16 Warm Up.
 The term “spreadsheet” covers a wide variety of elements useful for quantitative analysis of all kinds. Essentially, a spreadsheet is a simple tool.
PATTERN RECOGNITION LAB 2 TA : Nouf Al-Harbi::
Some “What’s the output” questions to get the day started… >>A = [1 2 3; 3 5 6] This statement stores the matrix: 1. A= 2. A= 3. A= 4. A= Ask Garvin’s.
Linear Algebra Review.
Built-in MATLAB Functions Chapter 3
Other Kinds of Arrays Chapter 11
Microsoft Office Illustrated
Topics Introduction to Value-returning Functions: Generating Random Numbers Writing Your Own Value-Returning Functions The math Module Storing Functions.
Introduction to Spreadsheet Terminology
CHAPTER 3 Built-in MATLAB Functions
Presentation transcript:

Recap Script M-file Editor/Debugger Window Cell Mode Chapter 3 “Built in MATLAB Function” Using Built-in Functions Using the HELP Feature Window HELP Screen Elementary Math Functions Rounding Functions Discrete Mathematics Trigonometric Function Data Analysis Function Maximum and Minimum Mean and Median

Sums and Products

Sorting Values

Matrix Size

Variance and Standard Deviation

Normal Distribution

Random Numbers Random numbers are often used in engineering calculations to simulate measured data Measured data rarely behave exactly as predicted by mathematical models, so we can add small values of random numbers to our predictions to make a model behave more like a real system Random numbers are also used to model games of chance Two different types of random numbers can be generated in MATLAB: Uniform random numbers Gaussian random numbers

Uniform Random Numbers Uniform random numbers are generated with the rand function. These numbers are evenly distributed between 0 and 1 We can create a set of random numbers over other ranges by modifying the numbers created by the rand function For example: to create a set of 100 evenly distributed numbers between 0 and 5 first create a set over the default range with the command r = rand(100,1); This results in a 100x1 matrix of values Now we just need to multiply by 5 to expand the range to 0 to 5: r = r * 5;

Example Continued…. If we want to change the range to 5 to 10, we can add 5 to every value in the array: r = r + 5; The result will be random numbers varying from 5 to 10. We can generalize these results with the equation x=(max - min). random_number_set + min

Gaussian Random Numbers

Continued…. If we need a data set with a different average or a different standard deviation, we start with the default set of random numbers and then modify it Since the default standard deviation is 1, we must multiply by the required standard deviation for the new data set Since the default mean is 0, we’ll need to add the new mean: x = standard_deviation. random_data_set + mean For example: to create a sequence of 500 Gaussian random variables with a standard deviation of 2.5 and a mean of 3, type x = randn(1500)* ;

Complex Numbers MATLAB includes several functions used primarily with complex numbers Complex numbers consist of two parts a real component an imaginary component For example: 5+3iis a complex number. The real component is 5, and the imaginary component is 3. Complex numbers can be entered into MATLAB in two ways: as an addition problem, such as A = 5 + 3i or A = 5+3*i or with the complex function, as in A = complex(5,3) which returns A = i

Continued…. As is standard in MATLAB, the input to the complex function can be either two scalars or two arrays of values Thus, if x and y are defined as x = 1:3; y = [-1,5,12]; then the complex function can be used to define an array of complex numbers as follows: complex(x,y) ans = i i i

real and imag Function The real and imag functions can be used to separate the real and imaginary components of complex numbers For example: for A = 5 + 3*i, we have real(A) ans =5 imag(A) ans =3

isreal Function The isreal function can be used to determine whether a variable is storing a complex number It returns a 1 if the variable is real and a 0 if it is complex Since A is a complex number, we get isreal(A) ans =0 Thus, the isreal function is false and returns a value of 0

Conjugate of Complex Number The complex conjugate of a complex number consists of the same real component, but an imaginary component of the opposite sign The conj function returns the complex conjugate: conj(A) ans = i The transpose operator also returns the complex conjugate of an array, in addition to converting rows to columns and columns to rows Thus, we have A' ans = i