Lecture note Data visualization - Chapter 24

The main contents of the chapter consist of the following: Plots with more than one line, plots of complex arrays, line, color and mark style, axis scaling and annotating plots, subplots, polar plots, logarithmic plots, bar graphs and pie charts, histograms, X-Y graphs with two Y-axes. | Lecture 24 Recap Plots with More than one Line Plots of Complex Arrays Line, Color and Mark Style Axis Scaling and Annotating Plots Subplots Polar Plots Logarithmic Plots Bar Graphs and Pie Charts Histograms X-Y Graphs with two Y-axes Function Plots The fplot function allows to plot a function without defining arrays of corresponding x - and y –values For example: fplot('sin(x)',[-2*pi,2*pi]) creates a plot (shown in next slide) of x versus sin( x ) for x -values from -2to 2 MATLAB automatically calculates the spacing of x -values to create a smooth curve The first argument in the fplot function is a string containing the function and the second argument is an array For more complicated functions that may be inconvenient to enter as a string, define an anonymous function and enter the function handle Three Dimensional Line Plots The plot3 function is similar to the plot function, except that it accepts data in three dimensions Instead of just providing x and y vectors, the user must . | Lecture 24 Recap Plots with More than one Line Plots of Complex Arrays Line, Color and Mark Style Axis Scaling and Annotating Plots Subplots Polar Plots Logarithmic Plots Bar Graphs and Pie Charts Histograms X-Y Graphs with two Y-axes Function Plots The fplot function allows to plot a function without defining arrays of corresponding x - and y –values For example: fplot('sin(x)',[-2*pi,2*pi]) creates a plot (shown in next slide) of x versus sin( x ) for x -values from -2to 2 MATLAB automatically calculates the spacing of x -values to create a smooth curve The first argument in the fplot function is a string containing the function and the second argument is an array For more complicated functions that may be inconvenient to enter as a string, define an anonymous function and enter the function handle Three Dimensional Line Plots The plot3 function is similar to the plot function, except that it accepts data in three dimensions Instead of just providing x and y vectors, the user must also provide a z vector These ordered triples are then plotted in three-space and connected with straight lines For example: clear, clc x = linspace(0,10*pi,1000); y = cos(x); z = sin(x); plot3(x,y,z) grid xlabel('angle'), ylabel('cos(x)') zlabel('sin(x)') title('A Spring') The title, labels, and grid are added to the graph in the usual way, with the addition of zlabel for the z -axis. The coordinate system used with plot3 is oriented using the right-handed coordinate system familiar to engineers Surface Plots Surface plots allow to represent data as a surface Two types of surface plots Mesh plots Surf plots Mesh Plots There are several ways to use mesh plots They can be used to good effect with a single two-dimensional mxn matrix In this application, the value in the matrix represents the z- value in the plot The x- and y- values are based on the matrix dimensions Take, for example, the following very simple matrix: z = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10; 2, 4, 6, 8, 10, 12, 14, 16, 18, .

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
Đã 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.