After MATLAB draws an image, draw the coordinate line and annotation variable at the specified point.

Source: Internet
Author: User

After drawing a two-dimensional plane image, sometimes we want to draw the coordinate line of the specified coordinate point, and want to make some annotations on the point, however, this point may change with our input.

The plot function can be used to draw a straight line between two points. This method can be used to draw the desired coordinate line.

When the text function is used for annotation, the annotation s in text (X, Y, S) is a string marked at [x, y, if the vertex we want to mark may change, it is obviously not possible to directly use the string in the text function. We can use the sprintf function to first obtain the string we want to mark, then use the text function annotation.

For example, we want to mark the coordinate value of this vertex at [3, 3] on the image of the Y = x function.

Ezplot ('x', 'B ');
Axis ([0, 5, 0, 5]);
Hold on
Plot ([], [], 'B', [], [], 'B ');
Syms x
F = x ^ 3 + 2 * X;
A = Subs (f, x, 1 );
Hold on
Plot (a, a, 'r *');
S = sprintf ('two spaces to get a better position [% d, % d] ', a, );
Text (a, a, S );

Shows the obtained image.

After MATLAB draws an image, draw the coordinate line and annotation variable at the specified point.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.