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.

Slides:



Advertisements
Similar presentations
Lecture 5.
Advertisements

Managerial Decision Making and Problem Solving Computer Lab Notes 1.
CMPS 1371 Introduction to Computing for Engineers FUNCTIONS.
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.
Maths for Computer Graphics
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 4 – Math on Arrays
MATLAB TUTORIAL Dmitry Drutskoy Some material borrowed from the departmental MATLAB info session by Philippe Rigollet Kevin Wayne.
Lecture 4 Sept 7 Chapter 4. Chapter 4 – arrays, collections and indexing This chapter discusses the basic calculations involving rectangular collections.
Dr. Jie Zou PHY Welcome to PHY 3320 Computational Methods in Physics and Engineering.
EGR 105 Foundations of Engineering I Session 3 Excel – Basics through Graphing Fall 2008.
Introduction to MATLAB ENGR 1187 MATLAB 1. Programming In The Real World Programming is a powerful tool for solving problems in every day industry settings.
Math – Getting Information from the Graph of a Function 1.
Builtin and user defined functions
1 Introduction to MATLAB MATLAB is all of the following: 1.Computational environment 2.Plotting software 3.Programming language Typical applications: 1.Calculations.
Vlachopoulos Georgios Lecturer of Computer Science and Informatics Technological Institute of Patras, Department of Optometry, Branch of Egion Lecturer.
Predefined MATLAB Functions ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne.
Recap Graphic Window Edit Window Start Button Matrices in MATLAB Scalar Operations Order of Operations Array Operations Matrix Addition Matrix Multiplication.
1 Week 3: Vectors and Matrices (Part III) READING: 2.2 – 2.4 EECS Introduction to Computing for the Physical Sciences.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
ENG 1181 College of Engineering Engineering Education Innovation Center MATLAB is a powerful program for numerical computations, plotting and programming.
Introduction to Engineering MATLAB – 1 Introduction to MATLAB Agenda Introduction Arithmetic Operations MATLAB Windows Command Window Defining Variables.
MATLAB An Introduction to MATLAB (Matrix Laboratory) 1.
Matlab for Engineers Built-in Matlab Functions Chapter 3.
Matlab Basics Tutorial. Vectors Let's start off by creating something simple, like a vector. Enter each element of the vector (separated by a space) between.
1 Lab 2 of COMP 319 Lab tutor : Shenghua ZHONG Lab 2: Sep. 28, 2011 Data and File in Matlab.
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.
Spreadsheet Functions. Functions  Simple functions Array functions IF - logical functions.
Recap Sum and Product Functions Matrix Size Function Variance and Standard Deviation Random Numbers Complex Numbers.
Introduction to MATLAB ENGR 1181 MATLAB 1. Opening MATLAB  Students, please open MATLAB now.  CLICK on the shortcut icon → Alternatively, select… start/All.
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
A string is an array of characters Strings have many uses in MATLAB Display text output Specify formatting for plots Input arguments for some functions.
Trigonometric Graphs.
Max and Min Trig Values. What is to be learned How to find the maximum and minimum values of trig functions. How to find when they occur.
Recap Saving Plots Summary of Chapter 5 Introduction of Chapter 6.
1 CS100J 02 May Matlab and PI and other things The notation j:k gives a row matrix consisting of the integers from j through k. The notation j:k gives.
ENG 1181 First-Year Engineering Program College of Engineering Engineering Education Innovation Center First-Year Engineering Program MAT - Introduction.
Programming with Matlab Day 2: More about Loops, Vectors and Matrices.
Array Creation ENGR 1187 MATLAB 2. Today’s Topics  Arrays: What are they?  Vectors  Matrices  Creating Arrays.
Introduction to MATLAB Session 2 Simopekka Vänskä, THL Department of Mathematics and Statistics University of Helsinki 2010.
1 Lecture 3 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
Lecture 24: Rough and Ready Analysis. MATLAB uses function names consistent with most major programming languages For example sqrt sin cos log.
A L I MAM M OHAMMAD B IN S AUD I SLAMIC U NIVERSITY C OLLEGE OF S CIENCES D EPARTMENT OF M ATHEMATICS MATLAB 251 : MATH SOFTWARE Introduction to MATLAB.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
CS 100Lecture 231 CS100J Lecture 23 n Previous Lecture –MatLab and its implementation, continued. n This Lecture –MatLab demonstration.
Matlab Tutorial Iman Moazzen First Session – September 11, 2013.
CS100A, Fall 1998, Lecture 201 CS100A, Fall 1998 Lecture 20, Tuesday Nov 10 More Matlab Concepts: plotting (cont.) 2-D arrays Control structures: while,
Notes Over 4.2 Finding the Product of Two Matrices Find the product. If it is not defined, state the reason. To multiply matrices, the number of columns.
A L I MAM M OHAMMAD B IN S AUD I SLAMIC U NIVERSITY C OLLEGE OF S CIENCES D EPARTMENT OF M ATHEMATICS MATLAB 251 : MATH SOFTWARE Introduction to MATLAB.
Outline What is MATLAB MATLAB desktop Variables, Vectors and Matrices Matrix operations Array operations Built-in functions: Scalar, Vector, Matrix Data.
Jake Blanchard University of Wisconsin Spring 2006.
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.
Arithmetic Operations
12-1 Organizing Data Using Matrices
Built-in MATLAB Functions Chapter 3
Computer Simulation Lab
EGR 106 – Week 4 – Math on Arrays
CS005 Introduction to Programming
Multiplying Matrices.
Multiplying Matrices.
Arrays in Matlab UC Berkeley Fall 2004, E Copyright 2005, Andy Packard
Matlab Basics Tutorial
CS100A Lecture 21 Previous Lecture This Lecture
Multiplying Matrices.
Multiplying Matrices.
Computer Simulation Lab
Multiplying Matrices.
CHAPTER 3 Built-in MATLAB Functions
Presentation transcript:

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 you can think of it, it is probably available – To find documentation, use Google to find documentation: e.g. google “sine matlab” google “standard deviation matlab”

Nesting of functions Just in regular math where one can use f(g(x)) Arguments can be scalars, vectors or matrices

Parameters (Arguments) Parameter and argument are almost synonyms sqrt(x) is a function with one parameter If we call sqrt as sqrt(4) 4 is the argument passed to the parameter sin(x) is a function of one parameter too If we call it as sin(sqrt(4)) It’s the value of sqrt(4) is passed as the argument to its one parameter.

Functions with multiple arguments We have encountered linspace(1,10,100) rand(3,4) rem(12.1,5.0) ans= 2.1

Matlab help You can use MATLAB help If you don’t know the name, use Google. Try “help” tab in MATLAB window.

More MATLAB Functions

Rounding Functions

Trigonometric Functions sin(x) sine of x expressed in radians) cos(x), tan(x) sind(x) sine of x in degrees cosd(x) tand(x) etc.

Data Analysis Functions max (maximum) min (minimum) mean (average) median sum (sum total of elements) prod (product) sort (sort elements) cumsum, cumprod (cummulative sum, prod)

mean

sum and cumsum

Example of mean with vector output

If you can imagine it, it is likely there

Sorting

Try Try out at least 10 of the functions I just described with both scalar and vector inputs – At least one of fix, round, ceil – At least one of the trig functions in radians and degrees. – Some of the sum, prod, cumsum – Try log of exp – Try max with vector output Compute the average location of the maximum values from the columns of the matrix magic(5) – Sort the rows of magic(5) according to the third colum n

Problem Problem 3.20: Throw one die Throw two dice Throw two dice 100 times along with the total of each throw Histogram the sum

Problem >> one=floor(rand(1)*6+1) one = 5 >> two=floor(rand(1,2)*6+1) two = 2 4 >> sim=floor(rand(2,10).*6+1) sim = >> total=sum(sim) total = >> hist(total);

Problem