Lecture note Data visualization - Chapter 23

This chapter presents the following content: Chapter 5 “plotting”, two dimensional plots, simple x-y plots, titles, labels and grids, multiple plots, plots with more than one line, plots of complex arrays, line, color and mark style, axis scaling and annotating plots, . | Lecture note Data visualization - Chapter 23 Lecture 23 Recap Chapter 5 Plotting Two Dimensional Plots Simple x y Plots Titles Labels and Grids Multiple Plots Plots with More than One Line A plot with more than one line can be created in several ways By default the execution of a second plot statement will erase the first plot However you can layer plots on top of one another by using the hold on command Execute the following statements to create a plot with both functions plotted on the same graph x 0 pi 100 2 pi y1 cos x 4 plot x y1 The hold on command can be used to layer plots on same graph Continued . Semicolons are optional on both the plot statement and the hold on statement MATLAB will continue to layer the plots until the hold off command is executed hold off Another way to create a graph with multiple lines is to request both lines in a single plot command MATLAB interprets the input to plot as alternating x and y vectors as in plot X1 Y1 X2 Y2 Continued . If the plot function is called with a single matrix argument MATLAB draws a separate line for each column of the matrix The x axis is labeled with the row index vector 1 k where k is the number of rows in the matrix. This produces an evenly spaced plot sometimes called a line plot If plot is called with two arguments one a vector and the other a matrix MATLAB successively plots a line for each row in the matrix For example we can combine y1 and y2 into a single Continued . Here s another more complicated example X 0 pi 100 2 pi Y1 cos X 2 Y2 cos X 3 Y3 cos X 4 Y4 cos X 5 Z Y1 Y2 Y3 Y4 plot X Y1 X Y2 X Y3 X Y4 This code produces the same result as Multiple Plots on Same Graph Continued . A function of two variables the peaks function produces sample data that are useful for demonstrating certain graphing functions Calling peaks with a single argument n will create an nxn matrix We can use peaks to demonstrate the power of using a matrix argument in the plot function The command plot peaks 100 results .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
476    16    1    25-11-2024
24    17    1    25-11-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.