laitimes

Walkthrough (14) - Matlab Study Note (1): Drawing 2D Diagrams

author:LearningYard学苑
Walkthrough (14) - Matlab Study Note (1): Drawing 2D Diagrams

Share interests, spread happiness,

Grow your knowledge and leave a good future.

Dear you, this is LearningYard!

Today, the editor brings you the article "A Closer Look (14) - Matlab Study Notes (1): Drawing a 2D Diagram. ”

Welcome to your visit.

Share interest, spread happiness,

increase knowledge,and leave beautiful.

Dear, this is LearningYard Academy!

Today, the editor brings you the article “Yue Lan (14):

Matlab Study Notes (1): Drawing 2D Diagrams.”

Welcome to visit!

1. Mind Maps

Walkthrough (14) - Matlab Study Note (1): Drawing 2D Diagrams

二、数据图像绘制简介(Introduction to Data Image Rendering)

The purpose of data visualization is to visualize the inner relationship between data from a mess of discrete data and feel the inner essence conveyed by Saturn. MATLAB pays special attention to the graphical representation of data, and is constantly improving and improving its visualization capabilities with new technologies.

The purpose of data lake visualization is to observe the internal relationship between data through graphs from a bunch of messy discrete data, and feel the inherent essence conveyed by Saturn. Matlab pays special attention to the graphical representation of data, and constantly adopts new technologies to improve and complete its visualization functions.

三、二维图的绘制方法(Drawing method of two-dimensional graph)

(一)基本语法(Basic grammar)

The Plot function is the core tool for plotting 2D graphs, which can help users visualize the relationship between data points or depict the trend of mathematical functions.

The Plot function is a core tool for drawing two-dimensional graphs, which can help users visualize the relationship between data points or depict the changing trend of mathematical functions.

plot(X,Y) can be used to create a 2D line plot of the corresponding values in Y against the corresponding values in X.

Plot (X, Y) can be used to create a two-dimensional line plot of the data in Y against the corresponding values in X.

plot(X1,Y1,...,Xn,Yn) 可在同一组坐标轴上绘制多对 x 和 y 坐标。 此语法可替代将坐标指定为矩阵的形式。

Plot (X1, Y1,..., Xn, Yn) plots multiple pairs of x and y coordinates on the same set of axes. This syntax is an alternative to specifying the coordinates as a matrix.

When plotting with the plot function, you need to obtain the x and y coordinates first, and then plot the curve, and x is often sampled at equal intervals. In practical application, if the change trend of the function with the independent variable is unknown, or the frequency characteristics of the function are very different in different intervals, the plot function is used to plot the graph, and if the sampling interval of the independent variable is set unreasonably, the change trend of the function cannot be reflected.

When using the plot function to plot, first obtain the x and y coordinates, and then draw the curve. X is often sampled at equal intervals. In practical applications, the trend of the function with the independent variable is unknown, or the frequency characteristics of the function vary greatly in different intervals. At this time, the plot function is used to plot graphs. If the sampling interval of the independent variable is set irrationally, the change trend of the function cannot be reflected.

(二)实例操作(Instance operation)

Drawing 2D diagrams in MATLAB is a basic and commonly used feature that can be implemented with a variety of built-in functions. Next, I will introduce you to the specific drawing method.

Drawing two-dimensional diagrams in MATLAB is a basic and commonly used function, which can be realized through a variety of built-in functions. Next, I will introduce the specific drawing method for you.

1.创建图像(Create image)

First, create a variable x, which is between 0-5 (every 0.1 points). Draw three lines about the variable x in the same coordinate system.

First, create a variable x that is between 0 and 5 (taking a point every 0.1). Draw three lines about the variable x in the same coordinate system.

Here's the code:

Code show as below:

Walkthrough (14) - Matlab Study Note (1): Drawing 2D Diagrams

The result is as follows:

The results are as follows:

Walkthrough (14) - Matlab Study Note (1): Drawing 2D Diagrams

2.图像的修饰(Retouching of images)

In MATLAB, retouching 2D image lines can be achieved in a variety of ways, including but not limited to changing line colors, line types, marker symbols, and adding legends, titles, axis labels, etc. Here are some basic steps and sample code to show how to make these modifications:

In MATLAB, modifying the lines of a 2D image can be done in a number of ways, including but not limited to changing the line color, line shape, marking symbols, and adding legends, captions, axis labels, etc. Here are some basic steps and sample code to show how to make these modifications:

(1)线条颜色与线型(Line color and line shape)

You can specify the line color using the color name or RGB value, set y1 to black, y2 to red, y3 to blue, and then modify the line type or data point type. The combination can be 'color + line' or 'color + dot'.

You can use the color name or RGB value to specify the line color, set y1 to black, y2 to red, y3 to blue, and modify the line or data point type. The combination method is'color + line type 'or'color + point type'.

Here's the code:

Code show as below:

Walkthrough (14) - Matlab Study Note (1): Drawing 2D Diagrams

The result is as follows:

The results are as follows:

Walkthrough (14) - Matlab Study Note (1): Drawing 2D Diagrams

(2)添加文本注释(Add text comments)

gtext and text are both functions for adding text annotations to a graph, but they work slightly differently. The gtext function allows the user to place text through mouse interaction. The text function allows you to programmatically add a text string at the coordinates (x, y) specified in the drawing. Here x and y are numeric values, which define the position of the text in the graph.

Both gtext and text are functions for adding text annotations to a graph, but they work slightly differently. The gtext function allows users to place text via mouse interaction. The text function allows you to programmatically add a text string at the coordinates (x, y) specified in the graph. Here x and y are numeric values that define the position of the text in the graph.

Walkthrough (14) - Matlab Study Note (1): Drawing 2D Diagrams

(3)添加轴标签(Add axis label)

In MATLAB, 'xlabel', 'ylabel', and 'zlabel' are functions used to label the x-axis, y-axis, and z-axis of a 2D or 3D graph, respectively, and to label the variable names or other descriptive information represented by the coordinate axes.

In MATLAB, 'xlabel', 'ylabel', and'zlabel 'are functions used to label the x-axis, y-axis, and z-axis of a two-dimensional or three-dimensional graph, respectively, to label the variable names or other descriptive information represented by the coordinate axes.

Add axis labels to the plot you just drawn:

Add axis labels to the diagram just drawn:

Walkthrough (14) - Matlab Study Note (1): Drawing 2D Diagrams

(4)添加图例(Add legend)

The legend function is used to create a legend for a chart, which can help to annotate the meaning of the different lines or marks in the chart.

The legend function is used to create the legend of a chart, which can help to label the meanings of different lines or markers in the chart.

Walkthrough (14) - Matlab Study Note (1): Drawing 2D Diagrams

If you learn it, why not try it now?

If you've learned it, you might as well try it now.

That's all for today's sharing.

If you have a unique idea for the article,

Welcome to leave us a message,

Let's meet tomorrow.

Have a great day!

That's all for today's sharing.

If you have a unique idea about the article,

please leave us a message,

and let us meet tomorrow.

I wish you a nice day!

Copywriting|yyz

Typography|yyz

Audit|hzy

翻译:ChatGPT

References: Bilibili, CSDN blog

This article is organized and sent by LearningYard, if there is any infringement, please leave a message in the background!

Read on