MATLAB_Plotting - Two Dimensional Plots / Chapter 5 Topics...

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

View Full Document Right Arrow Icon
Topics Covered: 1. Plotting basic 2-D plots. The plot command. Plotting multiple graphs in the same plot. Formatting plots. Two Dimensional Plots / Chapter 5
Background image of page 1

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

View Full DocumentRight Arrow Icon
MAKING X-Y PLOTS MATLAB has many functions and commands that can be used to create various types of plots. In our class we will only create two dimensional x – y plots.
Background image of page 2
8 10 12 14 16 18 20 22 24 0 200 400 600 800 1000 1200 DISTANCE (cm) INTENSITY (lux) Light Intensity as a Function of Distance Comparison between theory and experiment. Theory Experiment Plot title y axis label x axis label Text Tick-mark label EXAMPLE OF A 2-D PLOT Data symbol Legend Tick-mark
Background image of page 3

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

View Full DocumentRight Arrow Icon
TWO-DIMENSIONAL plot() COMMAND where x is a vector (one dimensional array), and y is a vector. Both vectors must have the same number of elements. The plot command creates a single curve with the x values on the abscissa (horizontal axis) and the y values on the ordinate (vertical axis). The curve is made from segments of lines that connect the points that are defined by the x and y coordinates of the elements in the two vectors. The basic 2-D plot command is: plot(x,y)
Background image of page 4
If data is given, the information is entered as the elements of the vectors x and y . If the values of y are determined by a function from the values of x , than a vector x is created first, and then the values of y are calculated for each value of x . The spacing (difference) between the elements of x must be such that the plotted curve will show the details of the function. CREATING THE X AND Y VECTORS
Background image of page 5

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

View Full DocumentRight Arrow Icon
PLOT OF GIVEN DATA Given data: >> x=[1 2 3 5 7 7.5 8 10]; >> y=[2 6.5 7 7 5.5 4 6 8]; >> plot(x,y) A plot can be created by the commands shown below. This can be done in the Command Window, or by writing and then running a script file. Once the plot command is executed, the Figure Window opens with the following plot. x y 1 2 3 5 7 7.5 8 6.5 7 7 5.5 4 6 8 10 2
Background image of page 6
PLOT OF GIVEN DATA
Background image of page 7

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

View Full DocumentRight Arrow Icon
plot() COMMAND Line specifiers can be added in the plot command to: Specify the style of the line. Specify the color of the line. Specify the type of the markers (if markers are desired). plot(x,y,’line specifiers’)
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/28/2011 for the course CHE 210 taught by Professor Swinnea during the Fall '08 term at University of Texas at Austin.

Page1 / 30

MATLAB_Plotting - Two Dimensional Plots / Chapter 5 Topics...

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

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