Home > Common Problem > body text

How to use hold on in matlab

藏色散人
Release: 2020-05-06 09:51:09
Original
42738 people have browsed it

How to use hold on in matlab

How to use hold on in matlab?

In the first step, we first need to know that hold on is mainly used to retain the current drawing when adding a new drawing. Enter the help hold command in the command line window and you can see the introduction, as shown in the figure below:

How to use hold on in matlab

In the second step, let’s use hold on, create an m file, and enter the

“
x=1:10;
y=[1 3 5 7 7 8 8 10 15 18]
plot(x,y,'-*')
hold on
x1=1:10;
y1=[1 2 3 4 5 6 7 9 15 18]
plot(x1,y1,'-*')
”
Copy after login

code, as shown below:

How to use hold on in matlab

The third step is to run the m file. You can see that two lines are drawn on one image. hold on is mainly used when drawing multiple lines, as shown in the following figure:

How to use hold on in matlab

In the fourth step, we can also look at the image of drawing multiple lines without using hold on, as shown below:

How to use hold on in matlab

After running the m file in the fifth step, you can see that only the latest line is drawn, as shown below:

How to use hold on in matlab

The above is the detailed content of How to use hold on in matlab. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template