Using matlab simple draw curves, and labeling, the legend, the screen grid, and other operations

Using matlab simple draw curves, and labeling, the legend, the screen grid, and other operations

Tools / materials

  • matlab software

Method / Step

  1. I used r2012 version is now simply draw two curves, a sine, cosine a different line widths, named curve. Procedures are as follows:

    x = 0: 0.001: 2 * pi;% create a time series

    y1 = 0.5 * sin (x);% creates sinusoidal

    y2 = cos (x);% create cosine curve

    % Corresponding to the width painting

    plot(x,y1,'r','LineWidth',0.5);

    hold on;

    plot(x,y2,'b','LineWidth',1);

    axis ([0 2 * pi -1 1]);

    % Curved axis title

    title ( 'profile');

    Videos matlab curve, tagging, legends, and other operations plus mesh
  2. The curve text annotation, I was just looking for two points on the curve, application text function:

    text (pi, 0, '\ leftarrow sine');

    text (pi / 2,0, '\ leftarrow cosine');

    Videos matlab curve, tagging, legends, and other operations plus mesh
  3. Obtaining maximum point of the curve to a curve as an example:

    [a2,b2]=max(y2);

    plot(x(b2),a2,'r*');

    text (x (b2), a2, 'maximum point curve 2');

    Videos matlab curve, tagging, legends, and other operations plus mesh
  4. Two exemplary curves of legend, and to join the grid. "

    Legend% plus

    Legend ( 'curve 1' 'curve 2');

    % Plus grid

    grid on;

    Videos matlab curve, tagging, legends, and other operations plus mesh

Published 10 original articles · won praise 27 · views 90000 +

Guess you like

Origin blog.csdn.net/szw_yx/article/details/76066752