Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Introduction to the basic Grammar of Matlab

Shulou Source: shulou.com Published: 2022-06-02 05:04:38 10月04日 Update

This article mainly explains "introduction to the basic Grammar of Matlab". Friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the introduction to the basic grammar of Matlab.

Two-dimensional data visualization

1. Basic drawing function

Plot (y): if it is a complex vector, then take the real part as the Abscissa and the imaginary part as the ordinate

Plot (XBI y)

Plot (XMagneyPol s): s represents a string token

Plot (x1 ~ Y1 ~ s 1 ~ 1...)

two。 Drawing of subgraph

Subplot (mnp) or subplot (mpene NJ p): a total of m lines with n graphs per line

3. Set axes

Axis (xmin xmax ymin ymax): defines the range of the x and y axes

Axis (xmin xmax ymin ymax zmin zmax): defines the range of x and y and z axes

Axis (xmin xmax ymin ymax zmin zmaxcmin cmax): defines the range of x and y and z axes, as well as color information for graphics

Axis off cancels the display of axes

4. Gridlines and borders

Grid on/off: add / remove gridlines

Grid minor: setting the spacing between grids

Box on/off: add or cancel the border of the axis

5. Scaling of axes

Zoom (factor): scaling of axes as a scaling factor

Zoom on/off: allow / disable scaling of axes

6. Drag and drop of graphics

Pan on/off

Pan xon/yon: dragging in the x / y direction

7. Data cursor

Datacursormode on/off: this function turns data-to-light ratio on or off

8. Draw a line

Line (XBI y)

Line (XMagneyMagnez): draw lines in 3D coordinates

9. Polar coordinate drawing

Polar (theta,rho):

Polar (theta,rtho,s): s stands for linear

10. Logarithmic and semi-logarithmic coordinate system

Semilogx (): X axis is logarithmic coordinate, y axis is proportional coordinate

Semilogy (): y axis is logarithmic coordinate, x axis is proportional coordinate

11. Double y-axis drawing

Using poltyy () to draw the double y-axis coordinate system, the Abscissa scale is the same. For the two groups of data, the left y-axis and the right y-axis are used respectively, and their coordinate axes are independent, so that the changing trend of the two groups of data can be well observed in one picture.

twelve。 Graphics window

Xlabel ()

Ylabel (); axis title

Title (); add a title to the graph

13. Figure legend

Legend ()

Legend ('off'): clear the legend

Legend ('toggle'): toggle between display and clear

14. Color bar

Colorbar ('location')

15. Text box callout

Text (): need to set the location

Gtext

16. Get and mark data points

[XQuery y] = ginput (n): select multiple points with the mouse

17. Drawing of special graphics

Bar (): bar chart

Barh () horizontal bar chart

Pie (): pie chart

Hist (): histogram, 10 histograms by default

Area (): area diagram

Scatter (): scatter plot

Contour (): draw a contour map

Errorbar (): error diagram

At this point, I believe you have a deeper understanding of the "introduction to the basic grammar of Matlab". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Coordinates axes graphics data logarithms ranges drawings syntax grids content functions legends coordinate systems directions title Abscissa histograms borders colors columns Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi MySQL macOS Docker vpn