Lecture+09+Notes+Exam02+Review (1)

Lecture+09+Notes+Exam02+Review (1) - 1 14:440:127...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 14:440:127 Introduction to Computers for Engineers Notes for Lecture 09 - EXAM02 Review Rutgers University, Fall 2010 Instructor- Brenda V. Cortez 1 Review - Plotting 1.1 X-Y Line Plots Key Idea 1: plot(X,Y) expects X and Y to be vectors of x points and y points. These vectors should be the same size. X and Y are just variable names and therefore can be named anything meaninful, as you saw in your HW with the volume/pressure problem. Key Idea 2: You could just as well do plot([1 2 3], [100 200 300]) , which plots the points (1,100), (2,200), and (3,300), connecting them with a line. Key Idea 3: You can often use the colon ( : ) or linspace operators to create the vector of x points. Key Idea 4: When calculating the y points, say if your equation is y = x 2 , remember to use the dot operator: y = x. 2 since x is a vector of points, and you want to square each individual point. Key Idea 5: After calling plot , you can call functions like title( ) , xlabel( ) , and ylabel( ) to title the graph, label the x axis, and label the y axis, respectively. Each of these functions takes a single string of characters as its input. Key Idea 6: axis[xmin xmax ymin ymax]) changes the graphs axes to whatver values you desire. 1.2 Plotting Multiple Things Key Idea 1: If you want to open different windows for different graphs, call the function gure(X) to refer to window number X . If that window already exists, youll now be able to overwrite the currently existing graph. If it doesnt exist already, MatLab will open a blank window and be ready for you to plot something in that window. Key Idea 2: If you want to plot multiple graphs on the same set of axes in the same window, your first method is to just call plot(x1,y1,x2,y2,...) . Note that you always give x points first, then follow them by the corresponding y points, then the next set of x points, then the corresponding y points, and so on. You can call legend(name1,name2,...) to create a legend. Each string in the legend will be added to the corresponding set of (x,y) points, as they were into the plot function above. Therefore, however many sets of x-y vectors you have, thats how many strings (separated by commas) you should send to the legend function. 2 Key Idea 3: If you want to plot multiple graphs on the same set of axes, and its not simple to use a single plot command (i.e. youre plotting a histogram on top of a pie chart, for whatever reason), type hold on after plotting the first graph. From then until you type hold off, youll be displaying everything on top of each other in the same window. Legends are more tricky to display using this method....
View Full Document

This note was uploaded on 03/24/2011 for the course ENGINEERIN 127 taught by Professor Finch during the Spring '08 term at Rutgers.

Page1 / 14

Lecture+09+Notes+Exam02+Review (1) - 1 14:440:127...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online