ENG 06 – Lecture 4 notes.docx

4 Pages
95 Views
Unlock Document

Department
Engineering
Course
ENG 6
Professor
A H M E D R A W Y
Semester
Spring

Description
ENG 06 – Lecture #5; 1/22/2013 Plotting  ginput o displays coordinates where a user clicked on a graph  Saving plots o File -> save as  Change file to format like jpg  Histogram o hist function o two arguments: data set, followed by number of bins (default is 10) o also functions for pie charts, box and whisker plots o search “specialized plotting”  3-D Plotting o plot3() command o 3 vectors, x, y, and z o You can also plot surfaces o Use meshgrid to generate matrices of points for z o Use mesh or surf functions to plot surface o Create top-down view of surface’s elevations using pcolour or contour  3-D Line Plot  3_D surfaces: meshgrid o 1 variable as a function of x and y o for every possible combo of x and y, you need a z value o plot a surface for x and y from 0 10 10, create meshgrid o [x y] = meshgrid(-10:10, -10:10); o z = x.^2-y.^2; o mesh(x,y,z);  3_D surfaces: surf o fills in surface  3-D surfaces: Pseudo color plot o 2 d value represented by color o use pcolour  3-D surfaces: contour plot o if you want to just display lines that connect points of the same z elevation o additional examples: type demo in command window, scroll down to graphics Review/Advanced/Details: Vectors  Vectors: Indexing o Process of extracting or inserting values in a vector o Syntax:  V(index) returns element(s) at location specified by index  V(index) = value replaces elements at specified locations  Numerical Indexing o Indexing vector can be any length of integers  Replacement Rules: o Either  All dimensions on either side of replacement instruction must be equal, or  There must be a single element on right side of replacement o If you replace beyond end of existing vector, vector length is increased  Other elements become 0  Caution: shortening a vector o Better to extract what you want by indexing than removing what you don’t want o Assign empty vector [] to elements of a vector  Operating on vectors o Arithmetic operations, logical operations, and applying library functions  Library Functions: o Sum(v) and mean(v) consume a vector and return a number o Min(v) and max(v) return two quantities: minimum or maximum value and the position in the vector o Round, ceil,floor, fix remove fractional part of numbers Review/Advanced/Details:Arrays  Resources: create elementary matrices: o Zeros o Ones o Eye: identity matrix o Linspace: linearly spaced vector o Logspace: logarithmically spaced vector o Meshgrid: x and y arrays for 3-D plots  Arrays: Indexing o A(row, col) returns elements at location specified o A(row, col) = value replaces elements at specified location o Indexing row and column vectors may contain either numerical or logical values  Arrays: Numerical Indexing o Indexing vectors can be of any length, include integers o For reading elements: 1<=element<=length(array dimension) o For replacing elements: 1<=element  Arrays: Replacement Rules o Same as vectors  Operating on Arrays o Same techniques as vectors with:  Arithmetic operations
More Less

Related notes for ENG 6

Log In


OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit