• How to plot a sine graph in MathCAD. Graphing functions

    Mathcad allows you to create new functions from one or more arguments. The function definition is written on a line in the following order:

    1. Name of the new function. The same rules apply to function names as to variable names.

    2. List of arguments in parentheses separated by commas.

    3. Standard assignment symbol " := ».

    4. An expression that determines the value of the function from its arguments.

    A call to a function is written in traditional mathematical form: a mention of the function name, immediately followed by a list of argument values ​​in parentheses separated by commas.

    Example 1.

    The following types of graphs can be constructed:

    1. Linear (in rectangular (Cartesian) and polar coordinates).

    2. Surface.

    3. Surface level lines.

    4. 3D bar chart.

    5. 3D point and vector graphics.

    To build any graph, you must first define on the sheet all the data necessary for construction, then insert the corresponding graphic region into the sheet and associate it with the displayed data. To insert a graphic region, you can use the corresponding panel buttons Math Graph or select the required item in the top menu Insert Graph(Insert Graph). Communication with the displayed data is made by specifying this data in the input positions of the graphic region.

    Let's take a closer look at the menu commands Math Graph(on the left are the corresponding panel buttons Graph):

    X-Y Plot (Cartesian graph) @ key. Used to plot a function graph y=f(x) in the form of pairs of coordinates related to each other ( x i, y i) for a given change interval for i.

    Polar Plot (Polar graph) keys Ctrl+7. Used to plot a function graph r(q), given in polar coordinates, where the polar radius r depends on the polar angle q.

    Surface Plot (Surface graph) keys Ctrl+2. Used to represent a function z=f(x, y) as a surface in three-dimensional space. In this case, value vectors must be specified x i And y j, and also a matrix of the form A i,j= f(x i,y j). Matrix name A indicated when filling out the template frame.

    Contour Plot (Level line map). Constructs a function level line diagram of the form z=f(x,y), i.e. it displays the points at which this function takes a fixed value z=const.

    3D Bar Plot (3D Bar Chart). Serves to represent a matrix of values A i,j z=f(x, y) as a three-dimensional bar chart.

    3D Scatter Plot (3D Scatter Plot). Serves for point representation of a matrix of values A i,j or displaying function values z=f(x, y) at given points. This command can also be used to plot spatial curves. In this case, when filling the template frame, you can specify three coordinates with separate vectors of the same dimension in the form .

    Vector Field Plot (Vector field). Used to represent two-dimensional vector fields V=(Vx,V y). In this case, the components of the vector field Vx And V y must be presented in the form of matrices. Using this command you can construct the gradient field of the function f(x,y).

    Two-dimensional graphs. For regions line graphs(Fig. 1) two main input positions are filled in - to the left and below the graph.

    A) b)

    Rice. 1. View of the region for a line graph up to ( A) and after ( b) filling in one of the main input positions

    In the lower position 2, an expression is indicated that determines the values ​​of the abscissa of the graph. Expression is the name of a sequence, vector, or regular variable. There can be multiple expressions separated by commas. If necessary, you can specify the minimum and maximum values ​​in additional positions 3 and 4.

    Position 1 contains an expression that determines the values ​​of the ordinates of the graph. You can list several expressions separated by commas - in this case several graphs will be built in the same coordinates. Expressions are usually functions of the argument specified in position 2. However, graphs of two functions specified parametrically can also be constructed, in this case the names of these functions are indicated in positions 1 and 2 (Fig. 2).

    Rice. 2. Fragment of a Mathcad sheet with linear graphs of two functions (parametric ( x(t); y(t)) and ordinary f(t))

    Formatting 2D graphs. To display the formatting window for a two-dimensional graph, simply place the mouse pointer in the graph area and double-click the left mouse button. A formatting window will appear in the document window (Fig. 4).

    It has a number of tabs:

    -X-Y Axes (X-Y axes);

    -Traces (Traces);

    -Labels (Tags);

    - Defaults (Default).

    A tab becomes active by placing the mouse pointer over its name and left-clicking.

    First of the tabs X-Y Axes(X-Y axes) allows you to format the coordinate axes:

    -Log Scale (Logarithmic scale) - specifies logarithmic axes, in this case the boundaries of the graph must be specified as positive numbers;

    - Grid Lines (Auxiliary lines) - sets the grid display;

    - Numbered (Numbering) - sets the display of captions for markings on the axes;

    - Autoscale (Autoscale) - sets the automatic detection of suitable boundaries for the axes. But if you yourself set the minimum and maximum values ​​in the corresponding cells x min, x max, y min, y max , these are the values ​​that will be used to determine the boundaries of the graph;

    - Show Markers (Show tags) - if you set this option, four additional cells will appear in the graphics area to create red marking lines corresponding to two special values x and two special meanings y;

    - Auto Grid (Auto grid) - when this option is set, the number of grid lines is determined by Mathcad.

    - Axes Style (Graph Axes Style) - a group of buttons in this area allows you to select the following options for representing axes: Boxed (Limited area), Crossed (Intersection) - axes intersect at a point with coordinates (0; 0), None (Without Borders). Checkbox Equal Scales (Equal scales) allows you to set the same scale for both axes.

    You can format the graph axis by double-clicking on it.

    To change the type of graph lines, you need to activate the tab Traces (Traces)(Fig. 5):

    - Legend Label (Legend) - each curve can be associated with some text called a legend. A legend appears at the bottom of the graphics area, and next to each legend the line type of the corresponding curve is displayed;

    - Symbol (Symbol) - allows you to select a symbol for each point of the curve (plus, cross, circle, etc.);

    - Line (Line) - you can select one of the following line types: solid (solid), dash (dashed), dot (dotted) or dadot (dash-dotted). This list field is available if the field Type (Type) the lines element is selected;

    - Color (Color) - sets the color of the curve presentation on the screen;

    - Type (Type) - allows you to select one of the graph types: in the form of lines, in the form of points, etc.;

    - Weight (Weight) - allows you to set the thickness of the graph lines.

    At the bottom of the tab Traces options are located:

    - Hide Arguments (Hide arguments) - this option is disabled by default. In this case, the current line type is indicated under the function name next to the y-axis. If you set this option, the line type indication will disappear;

    - Hide Legend (Hide legend) - by default the legend is not displayed. If you want to display legend text under the graph, you must first enter it in the field Legend Label (Legend) and confirm your entry by clicking on the button Apply.

    Tab Labels (Tags) allows you to enter a title for the graph and labels for the axes (Fig. 6).

    On the menu Format Graph (Format Schedule) contains the command Zoom (Changing the scale). Using this command, you can enlarge a fragment of the graph by first selecting it by dragging the mouse with the left button pressed. After releasing the key, the coordinates of the corners of the selected area will be displayed in the window fields X-Y Zoom(Fig. 7). Using the button Zoom (Scale +) the fragment can be enlarged using the button Unzoom (Scale –) deselect the fragment, and using the button Full View (Review) - restore the original appearance of the graph. If you have enlarged a fragment of the graph, then when you click on the button OK Only this fragment will be displayed in the document.

    Three-dimensional graphics. Graphing a Function z=f(x, y) as a surface in a Cartesian coordinate system. To construct a surface graph, you can use two methods:

    1. You need to define a function f(x,y) and on the panel Graph choose Surface Plot(Surface graph). In the graphical area that appears, under the axes, in place of the input template, you must specify the name (without arguments) of the function. Independent Variables x And y take values ​​from the interval [–5; 5] (Fig. 8).

    If necessary, this gap can be reduced or increased. To do this, double-right-click on the selected chart and in the window that appears 3D Plot Format (3D graphics format) on the tab QuickPlot Data you can set other parameters for changing independent variables x And y(Fig. 9).

    2. To construct a surface graph in a certain area of ​​change in independent variables or with a specific step of their change, you must first set the nodal points x i And y j, in which the function values ​​will be determined. After (or maybe before) this, you need to define the function f(x, y), the graph of which you want to plot. After this, it is necessary to generate a matrix of function values ​​in the form: A i,j=f(x i, y j) (Fig. 10).

    Now after executing the command Graph Surface Plot in the graphical area that appears, just enter the name of the matrix (without indices).

    3. Also, to plot a surface graph in a certain area of ​​change in independent variables or with a specific step of their change, you can use the function:

    M:=CreateMesh(f,xn,xk,yn,yk,s1,s2),

    Where f- function defining the surface; xn, xk, yn, yk- initial and final values ​​of independent variables x And at; s1, s2- grid dimension.

    After executing the command Graph Surface Plot in the graphical area that appears, enter the name of the variable (in this case M).

    Plotting a curve in space. Three-dimensional scatter plots can be used to plot spatial curves. Spatial curves are specified, as a rule, in the form ( x(t), y(t),z(t)), Where t is a continuous real parameter (Fig. 11).

    Since, when constructing a three-dimensional scatter plot, Mathcad allows you to display only individual points and the lines connecting them on the graph, you must first define three coordinate vectors - x i,y i,z i. A space curve is created with the command Graph Scatter Plot.

    Formatting 3D graphs. If you are not happy with the appearance of the generated 3D plot, you can change it by running the command Format -> Graph -> 3D Plot or by double-clicking on the graphic area. As a result, a dialog box will appear on the screen 3D Plot Format, which allows you to change the chart display parameters. We'll look at the main options here. You can understand all the intricacies of managing the chart type yourself by constructing a chart and experimenting, choosing certain options.

    Dialog window 3D Plot Format contains several tabs (Fig. 12).

    On the tab General (General):

    In area View (View) you can set the direction of view of the observer on the three-dimensional graph. Field value Rotation determines the angle of rotation around an axis Z in the plane X-Y. Field value Tilt sets the angle of inclination of the line of sight to the plane X-Y. Field Zoom allows you to enlarge (reduce) the graphic image by a number of times equal to the number specified in the field;

    In area Axes Style (Axes style) set the type of axes by selecting the selector button Perimeter (Perimeter) or Corner (Corner). In the first case, the axes are always in the foreground. When selecting a button Corner axis intersection point Ox And Oy is given by the element A 0.0 matrix A;

    In area Frames (Graph Boundaries) option Show box (Frame) is intended to display a cube with transparent edges around the graph, and the option Show border (Borders) allows you to enclose the graph in a rectangular frame;

    In area Plot 1 (Plot 2...) Display as: (Chart 1 Show as:) there are selector buttons for presenting the graph in other types (contour, dot, vector field, etc.);

    Tab elements Axes (Axis) allow you to change the appearance of the coordinate axes (Fig. 13).

    Through Area Options Grids (Grids) can be displayed on a graph by lines described by the equations x,y,z= const.

    If options are installed Show Numbers (Numbering), labels on the axes and their captions are displayed.

    At the same time, next to the axes Ox And Oy the values ​​of the node points are not indicated x i, y j, and the index values i And j, while the axis Oz is marked in accordance with the interval to which the elements of the value matrix belong A i,j.

    If the option is installed Auto Grid (Auto grid), the program independently sets the distance between adjacent marks on the axes. You can specify the number of grid lines yourself if you disable the specified option.

    If the option is installed Auto Scale (Auto scale), then Mathcad itself determines the boundaries of plotting and the scales along the axes. You can disable this option and independently set the limits for changing variables in the fields for each axis Minimum Value(Minimum) And Maximum Value (Maximum).

    Tab Appearance (Appearance) allows you to change the type and color of the surface fill (area) for each graph Fill Options); type, color and thickness of additional lines on the graph (area Line Options); plot data points (optional Draw Points region Point Options), change their appearance, size and color.

    Tab Lighting (Lighting) when the option is enabled Enable Lighting (Turn on lighting) allows you to select a color scheme for lighting, install several light sources, choosing the lighting color for them and determining its direction.

    Tab Backplanes (Base) allows you to change the appearance of the planes that limit the construction area: color, applying a mesh, determining its color and thickness, drawing the boundaries of the planes.

    On the tab Special (Special) you can change construction parameters specific to different types of graphs.

    Tab Advanced (Additionally) allows you to set printing parameters and change the color scheme for coloring the graph surface, as well as specify the direction of color change (along the axis Ox, Oy or Oz). Enabling the option Enable Fog (Presence of fog) makes the graph unclear, slightly blurry (translucent). When you enable the option Perspective (Perspective) it becomes possible to indicate the distance to the observer in the corresponding field.


    Related information.


    MathCAD has been providing stable support for its functions for many years. Economists, scientists, students and other specialists proficient in applied and analytical mathematics work in this computing environment. Since the mathematical language is not understandable to everyone, and not everyone is able to learn it quickly, the program becomes difficult for novice users to understand. A busy interface and a large number of nuances discourage people from using this product, but in fact, it is possible to understand any working environment - all you need is the desire. In this article we will examine such an important topic as plotting function graphs in Matkada. This is a simple procedure that very often helps with calculations.

    Types of charts

    In addition to the fact that MathCAD defines quick graphics that can be called using hotkeys, there are other graphical applications. For example, the user can find the “Insert” section in the program header, and in it - the “Graph” subsection, in which you can view all available graphs in Matkada:

    • X-Y graph - shows the dependence of one value on another. The most common type, which allows you to quickly evaluate and explore dependencies.
    • Polar plot - uses polar coordinates. The essence of the graph is to show the dependence of one variable on another only in the polar coordinate plane.
    • Surface Graph - Creates a surface in space.
    • Vector field, 3-D scatter plot, 3-D bar plot are used for other special purposes.

    Graphing a Function

    It is impossible to learn how to work with the computing environment without examples, so we will understand MatchCAD using a template.

    Let's say a function f(x) = (e^x/(2x-1)^2)-10 is given in the interval [-10;10], which needs to be constructed and researched. Before you start plotting a function, you need to convert this function into mathematical form in the program itself.

    1. After the function has been specified, you should open the quick chart window with the Shift + 2 key. A window appears in which 3 black squares are located vertically and horizontally.
    2. Vertically: the top and bottom ones are responsible for the intervals of values ​​that can be adjusted, the middle one specifies a function by which the user can build a graph in Matkada. We leave the outer black squares unchanged (the values ​​will be automatically assigned after construction), and write our function into the middle one.
    3. Horizontally: the extreme ones are responsible for the intervals of the argument, and in the middle one you need to enter “x”.
    4. After these steps, a graph of the function will be drawn.

    Building a graph using points in Matkada

    1. Let's set the range of values ​​for the argument, in this case x:=-10,-8.5.. 10 (the ".." symbol is inserted when you press the ";" key).
    2. For convenience, we can display the resulting values ​​of “x” and “y”. For the first case we use the mathematical formulation "x=", and for the second - "f(x)". We observe two columns with corresponding values.
    3. Let's build a graph using the key combination Shift + 2.

    Note that the part of the graph that was heading upward has disappeared, and in its place a continuous function has formed. The whole point is that in the first construction the function underwent a discontinuity at a certain point. The second graph was plotted using points, but it is obvious that a point that did not belong to the graph is not displayed here - this is one of the features of constructing graphs based on the principle of points.

    Tabulation of graphics

    To get rid of the situation where the function undergoes a discontinuity, it is necessary to tabulate the graph in Matkada and its values.

    1. Let's take the interval we know from -10 to 10.
    2. Now let's write the command for the variable range - x:=a,a + 1 .. b (do not forget that the colon is the result of pressing the ";" key).
    3. Looking at the given function, we can conclude that with the value “x=1” division by zero will occur. In order to tabulate the function without problems, it is worth eliminating this operation as shown in the picture.
    4. Now you can visually display the values ​​in columns, as we did with the plotting by points. The tabulation is completed, now all values ​​in increments of one unit correspond to their arguments. Note that on "x=1" the value of the argument is undefined.

    Minimum and maximum functions

    To find the minimum and maximum of a function in a selected area of ​​the graph in Matkada, you should use the Given auxiliary block. When using this block, you need to set the search interval and initial values.

    1. In the case under consideration, the initial value is x:=9.
    2. Let's write a working command to find the maximum value - X max =Maximize(f,x) and calculate the value using the equal sign.
    3. We will write the condition for x using the Given block.
    4. We set the minimum of the function by analogy with the maximum.
    5. The results were as follows: the minimum value on the chart with the specified interval is f(x) = 2.448*10,198, and the minimum value is f(x) = -10.

    In this tutorial, we'll look at the charting options available in PTC Mathcad Prime 3.0.

    Types of charts

    To change the graph type, click on it, then select Graphs tab -> Curves -> Change type. Below are pictures of four types of graphs for a function:

    There are some other axis types in the list - we'll use some of them later.

    Several graphs on the same axes

    To add a curve to an axis, place the cursor after the graph's Y-axis legend and click Graphs -> Curves -> Add Curve. Another placeholder for the Y axis will appear:

    You can add more graphs using the same command.

    By displaying several graphs on the same axes, we will look at various settings from the Graphs -> Styles menu. For this purpose, we will create axes with five different straight lines. Each line contains 11 points:

    Below these expressions, insert an XY plot, then add four legends for the Y axis. In the X-axis placeholder, enter x—all five plots will use the same X-axis legend. In the final Y-axis placeholder, enter y:

    Above you should enter y:

    Parametric graph

    This circle plot is plotted using the parameter t:

    Logarithmic graphs

    The logarithmic scale is often used in various fields of science and technology. Plotting plots on a logarithmic scale is available in Mathcad.

    Let's plot the function y=x 2, but using the parameter:

    To make the X-axis logarithmic, select the X-axis legend and click Graphs -> Axes -> Logarithmic Scale. Do the same for the Y axis. On a logarithmic scale, this function is a straight line:

    Summary

    In this lesson we showed how you can modify two-dimensional graphs.

    1. To change a curve type, click on its Y-axis legend and select Graphs –> Curves –> Change Type.
    2. To add a curve:
    • place the cursor on the Y-axis legend;
    • Click Graphs –> Curves –> Add Curve.
    1. To change the symbols, color, style, or thickness of a curve, click on the Y-axis legend of the corresponding graph and customize the graph using the Graphs -> Style menu.
    2. To scale a graph, divide the appropriate axis legend by the scaling factor.

    Formulation of the problem:

    1. Construct a graph of the function f(x) according to the option from table No. 1. Find and write approximate roots of the equation f(x)=0 using tracing.

    2. Construct two combined graphs f1(x) and f2(x), where f1(x)-f2(x)=f(x) on the same coordinate plane. Find and write approximate roots of the equation f(x)=0 using tracing.

    3. Copy the graph of the function f(x), change the style of the axes on it from constraint to intersection.

    4. Find the exact roots of the equation f(x)=0 using the root function.

    Typical example:

    Task 1. Graph the function . Find and write approximate roots of the equation f(x)=0 using tracing.

    1. Select the X-Y Coordinates (X-Y-Plot) button on the Graph Toolbar - an empty graph template will appear.

    2. Enter the function in the y-axis label, and the unknown variable x in the x-axis label, press Enter - a graph of the function will appear.

    3. Where the function intersects the ox axis, there are the roots of the equation. Let's format the graph to find approximate values ​​of the roots. For this:

    3.1. left-click on the graph, change the minimum and maximum limits of change in x (-5;5), y (-3;3) and press Enter;

    3.2. Double-click on the graph and the Formatting Currently Selected X-Y Axes dialog box will appear. The window contains 4 spines: X-Y Axes, Traces, Labels, Defaults.



    3.3. in the X-Y Axes spine there are items for selecting the formatting of the graph axes:

    Mern. ruler (Log Scale) – numbers the axes in logarithmic sequence;

    Grid Lines – displays auxiliary grid lines;

    Numbered – displays the numbering of the axes;

    Autoscale – sets automatic scale;

    Show Markers – sets the mode for displaying markers;

    Number Of Grid – Set the number of auxiliary grid lines.

    Axes Style – allows you to select the style of display of the chart axes:

    Boxed – displays the graph in a frame without axes;

    Crossed. (Crossed) – displays a graph with axes;

    None – displays a graph without axes and frames.

    Equal Scale – sets the x and y axis to equal scale.

    For our schedule check the boxes for each axis: Grid Lines, Numbered, set the Number of Grids along the x-axis to 10, along the y-axis to 6, and select the axis style - Boxed.

    3.4. The Traces tab contains items for formatting graph lines.

    Legend Label – conditional number of the graph line;

    Symbol, Line, Color, Type, Weight – set the characteristics of the line on the graph.

    Hide Arguments – removes the x and y axis labels from the screen;

    Hide Legend – removes the graph line label from the screen.

    For our schedule change the Color to blue and set the Weight to =2.

    4. Using tracing, we find approximate roots of the equation. To do this, right-click on the graph and select the Trace command. When the X-Y-Trace window appears, click on the curve with the left mouse button at the point of intersection of the graph curve and the x-axis - the values ​​x,y appear in the window, where x is the approximate root of the equation.

    5. Complete task 1 as shown in Fig. 1.

    Rice. 1. Graph of the function f(x)

    Task 2. Construct two combined graphs f1(x) and f2(x), where f1(x)-f2(x)=f(x) on the same coordinate plane. Find and write approximate roots of the equation f(x)=0 using tracing.

    1. Let's split the function into two, moving it to the right side, we get . Let's plot two functions y= and y= on one graph. To do this, select the X-Y-Plot button - an empty plot template will appear.

    2. Enter - , then, then , into the y-axis label, and the unknown variable x into the x-axis label, press Enter - a combined graph of the two functions will appear.

    3. Where the functions intersect, there are the roots of the equation. Let's format the graph in the same way as in the previous task. Using tracing, we will find the approximate roots of the equation.

    4. Complete task 2 as shown in Fig. 2.

    Rice. 2. Combined graph of functions

    Task 3. Copy the graph of the function f(x), change the style of the axes on it from restrictions to intersections.

    1. Select the graph of the function by drawing a frame around it. From the Edit menu, select the Copy command. Place the cursor where the copied chart will be located. Select the Paste command from the Edit menu.

    2. Double-click on the graph and the Formatting Currently Selected X-Y Axes dialog box will appear. In the X-Y Axes box, change the checkbox from Boxed to Crossed. (Crossed)

    3. Complete task 3 as shown in Fig. 3.

    Rice. 3. Graph of a function with axes

    Task 4. Find the exact roots of the equation f(x)=0 using the root function.

    Task options:

    Table 1

    Type of function f(x) Type of function f(x)
    1. sin(x) + 4x – 1 19. x 1/2 – 2sin(x)
    2. x 3 + 5x – 3 20. 1/(2x) – cos(x)
    3. e x + x 2 – 3 21. 3sin(x) – x 2 + 1
    4. e x + 2x – 2 22. cos(x) – 2x 2
    5. x 3 + 5x 2 – 1 – x 23. x 1/3 – cos(3x)
    6. x 2 - 20sin(x) 24. tg(x) – 2x
    7. ctg(x) – x/10 25. log(x) – 2cos(x)
    8. x 3 – 3x 2 – 9x + 2 26. 2ln(x) – x 3 + 6
    9. x 3 – 6x – 8 27. 3ln(x) – x/4 – 1
    10. tg(0.5x) – x 2 28. 2ln(x) – 1/x
    11. 5 x – 1 – 2cos(x) 29. e x + x 2 – 2
    12. ctg(x) – x/2 30. x 3 + 4x 2 – 8
    13. e -x – (x – 1) 2 31. ln(x) + 7/(2x + 6)
    14. x×ln(x) – 1 32. e -x - x 2
    15. 2 x – 2x 2 + 1 33. ln(x) – x -2
    16. x - 0.5sin(x) – 2 34. x - sin(x) – 0.25
    17. 2cos(x) – (x 2)/2 35. x - 3cos 2 (x)
    18. x 2 – (x) –2 + 10x

    Control questions:

    Types of charts

    MathCAD has several different types of graphs built-in, which can be divided into two large groups.

    2D graphs:

    X-Y (Cartesian) plot (X-Y Plot);

    Polar Plot.

    3D graphics:

    3D surface plot (Surface Plot);

    Contour Plot;

    3D Bar Plot;

    Three-dimensional set of points (3D Scatter Plot);

    Vector Field Plot.

    Create a graphics area

    MathCAD has a special Graph panel for creating and displaying a wide variety of graph types. In order to display this panel on the monitor screen, you need to click the button on the Math panel. Let's take a closer look at the purpose of the buttons on the Graph panel from left to right (Fig. 25).

    Rice. 6.1. Graph

    – creation of a Cartesian graph;

    – change the scale of the selected area of ​​the graph;

    – determination of the coordinates of the selected point on the graph;

    – creation of a polar graph;

    – creating a graph of a three-dimensional surface;

    – creating a contour plot;

    – creation of a three-dimensional histogram;

    – creation of 3D scatter;

    – creation of a vector field.

    There are three ways to create a graphics area in MathCAD. The first way to create is using the Graph toolbar, the second is using the main menu, the third is using the keyboard. To create a graph using any of these methods you must:

    1) Place the input cursor at the place in the document where you want to insert the graph.

    2) Create a coordinate grid for the graph of the function. To do this, do one of the following:

    · Click on the Graph panel button with the desired graph type ;

    · On the main panel, click the following sequence of commands: Insert / Graph / Select the desired graph type;

    · Press the key combination on the keyboard in accordance with the table. 4.

    Table 4 Keyboard shortcut for creating a graphic area

    Keyboard shortcut

    Template name

    Explanations

    Cartesian graph

    Polar graph

    Surface graph

    Contour plot

    Rice. 6.2. Schedule

    As a result, an empty graph area will appear in the designated area of ​​the document with one or more placeholders that need to be filled.

    In the case of a two-dimensional graph, you must enter the name of the argument in the marked position near the x-axis, and the name of the function in the position near the ordinate axis. If you need to simultaneously plot graphs of several functions, you must enter their names in the position near the ordinate axis, separated by a comma (Fig. 26). Instead of the function name, you can enter an expression to evaluate it.

    Rice. 6.3. Construction

    When constructing a three-dimensional graph, you need to fill out a single

    placeholder in the lower left corner. In this placeholder you should enter either the name z of a function z(x,y) of two variables to quickly plot a three-dimensional plot (Fig. 27), or the name of a matrix variable z, which will specify the distribution of the data z x , y on the XY plane.

    1) Press F9 or click outside the graphics area to plot the graph.

    Scaling and reading graph coordinates

    1) Determining the coordinates of points on the graph

    If necessary, the user can find out the coordinates (in pixels) of any point on the graph. To do this, select the graph and press the button on the Graph toolbar. The X-Y Trace or Polar Trace dialog box appears (Figure 28). Then you should place the mouse pointer on the graph points and read the coordinates of the points. When the Track data Points box is checked, the mouse pointer will follow the curve exactly and display the values ​​of the running points. Clicking the Copy X or Copy Y buttons will save the x and y coordinate values ​​that appear in the X-Value and Y-Value boxes, respectively, to the buffer.

    Rice. 6.4 Points

    2) Scaling the selected area

    To increase the size (scaling) of some area of ​​interest in the graph, you must use the Zoom command on the toolbar

    Graph(Graph). After executing the command, the X-Y Zoom or Polar Zoom dialog box appears (Fig. 29), the area that needs to be enlarged is selected on the graph, and the Zoom button is pressed.

    Rice. 6.5 Magnification

    As a result, the selected area will be displayed across the entire chart window. If necessary, the command can be repeated.

    The Unzoom button allows you to unzoom the selected area. The Full View button allows you to return this area to its original form.

    3) Changing the original sizes of graphs

    You can change the size of the window in which the function graph is shown in the vertical, horizontal and diagonal directions (Fig. 30).

    Rice. 6.6 Resizing

    To change the size of a picture, you need to accurately move the graphic cursor to the special marks on the frame highlighting the picture. These marks look like small black rectangles. The cursor image is replaced with a double-sided arrow, indicating in which directions it is possible to change the size of the graph. By pressing the left mouse button, you can grab the corresponding side or corner of the design template and, without releasing the key, begin to stretch or compress the template frame. After the key is released, the drawing will be rearranged in new sizes.

    4) Moving and deleting a chart

    To move the chart you need to:

    1) Enclose the graph in a dotted highlight rectangle. To do this, you need to click the left mouse button outside the graph area and, holding it down, move the mouse so that the dotted rectangle that appears covers the entire graph, and then release the mouse button.

    2) Move it with the mouse to a new location. To do this, you need to move the cursor to the graph frame and as soon as the cursor changes its appearance from an arrow to a palm, press the left mouse button and move the picture to the desired location, then release the mouse button.

    To delete a chart you need:

    1) Click on the graph to select it;

    2) Execute the Cut command from the Edit menu.

    After deleting a graph, MathCAD leaves an empty field.

    Formatting graphs

    1) Formatting a Cartesian graph

    To format the graph, double-click on the graph field. MathCAD will open a dialog box for formatting graphs, which has four tabs:

    1) Using the X-Y Axes tab (Fig. 31), the shape and appearance of its axes are formed.

    Log Scale – setting a logarithmic scale;

    Grid Lines – setting grid lines;

    Numbered – setting digital data for the axes;

    Autoscale – automatic chart scaling;

    Show Markers (Apply risks) – setting divisions along the axes to add background lines (asymptotes, boundary values, etc.) to the graph; On each of the axes

    It is allowed to install two markers.


    If only one of them is defined, the second one will not be visible.

    Auto Grid – automatic installation of scale lines. If the Auto Grid checkbox is checked, then the number of intervals on the axis is selected automatically, if not, then this number is set by the user in the Number of Grids field from 2 to 99;

    Rice. 6.7. Setting scale lines

    Number of Grids – Sets the specified number of scale lines.

    Setting the axes style is done using the buttons:

    Boxed – axes in the form of a rectangle;

    Crossed – axes in the form of a cross;

    None – no axes;

    Equal Scales – setting equal scales along the graph axes.

    2) Using the Traces tab (Fig. 32), the curves displayed on the graph are formatted.

    The graph can contain up to 16 curves. The properties of the selected curve are placed in the edit line (at the bottom), which has the following fields:

    Legend Label – specifying the name of the curve for the legend;

    Symbol (Marker) – it specifies which symbol to mark the nodal points on the chart (it can take one of the following values: none (no mark), x’s

    (oblique cross), +’s (straight cross), box (square), dmnd (diamond) and o’s (circle));

    Line – sets the type of line on the chart: solid (solid), dot (dots), dash (dashed) and dadot (dashed);

    Color – sets the color of the curve: red (red), blu (blue), grn (green), mag (lilac), cya (sky blue), brn (brown), blk (black) and wht (white) ;

    Rice. 6.8 Lines

    Type (Type) - sets the type of graphs: lines (curve), points (point), error (error interval of two functions: plotting with vertical bars with an estimate of the error interval), bar (rectangular - plotting in the form of histogram columns), step (stepped) , draw (straight-line) and stem (rod);

    Weight (Thickness) – controls the thickness of the chart (from 1 to 9);

    Two more options are related to the ability to remove auxiliary labels from the chart:

    Hide Argument (Hide variables) – hides the symbols of mathematical expressions along the graph axes;

    Hide Legend – hides the names of the chart curves.

    3) The Label tab (Fig. 33) allows you to enter additional labels into the drawing. This panel appears if the current chart has already been created.

    Small windows are used to install inscriptions:

    Title – setting the title inscription for the picture;

    X-Axis (X-axis) – setting the label on the X axis;

    Y-Axis (Y-axis) – setting the label for the Y axis.

    Rice. 6.9. Installing labels

    The Title section contains the Above and Below options for setting the title either above or below the picture. The activation of these options is indicated by placing a bold dot in the circle. In addition, the Show Title option allows you to turn on or off the display of the title text. To activate it, use a square window (empty - if you refuse to display the inscription and with a cross - when you display the inscription).

    4) Using the Defaults tab (Figure 34), you can change the default values ​​(this is one way to create a new set of default values).

    Two settings are used:

    Change to Defaults button, which allows you to cancel all changes made during the chart formatting process;

    Use for Defaults selection box that creates a set of default values.

    Thus, formatting the graph makes it possible to modify the template to suit the user's requirements.

    Rice. 6.10. Settings

    2) Formatting 3D graphs

    When you double-click on a plot template, the 3D Plot Format dialog box appears (Fig. 35). It contains the following bookmarks:

    General general image parameters;

    · Axes – setting options for representing axes;

    · Appearance (View) – graph display parameters (color of lines and type of points used when constructing figures and surfaces);

    · Lighting – parameters of lighting conditions and schemes;

    · Title – title inscriptions and their parameters;

    · Backplanes (faces) – parameters of faces;

    · Special (Special) – contour lines, columns, interpolation by light, etc.);

    · Advanced (Advanced) – perspective, lighting effects, print quality, etc.);

    · QuickPlot Data – options for quick plotting.

    General tab

    The General tab contains the following groups (Fig. 35).

    View:

    Rice. 6.11 Formation

    Ø Rotation – setting the rotation angle (from 0 to 360 degrees);

    Ø Tilt – setting the tilt angle (from 0 to 180 degrees);

    Ø Twist – setting the rotation angle (from 0 to 360 degrees);

    Ø Zoom – relative size (default 1).

    Axes Style:

    Ø Perimeter(Perimeter);

    Ø Corner (Angle);

    Ø None(Absent);

    Ø The Equal Scales checkbox specifies equal scales on all axes.

    Frames:

    Ø Show Border – frame around the graph;

    Ø Show Box – a parallelepiped framing the graph.

    Rice. 6.12. Formation 2

    Plot 1 – switches for selecting the type of three-dimensional plot:

    Ø Surface Plot;

    Ø Contour Plot;

    Ø Data Points;

    Ø Vector Field Plot;

    Ø Bar Plot (Histogram);

    Ø Patch Plot.

    Axis tab

    The Axis tab contains groups (Fig. 36).

    Grids – allows you to set the coordinate grid format:

    Ø Draw Lines checkbox – displays grid lines;

    Ø Draw Tics checkbox – displays divisions on the axes;

    Ø Auto Grid checkbox – automatic selection of the number of lines;

    Ø Line Color field – specifying the line color;

    Ø Number field – specifying the number of divisions;

    Ø Line Weight field – setting the thickness of the grid lines.

    Axis Format – allows you to set the format of the coordinate axes:

    Ø Show Numbерs (Show numbers) – digitization of axes;

    Ø Axis Color – set the color of the axes;

    Ø Axis Weight – set the thickness of the axis lines.

    Axis Limits – allows you to set the limits for coordinate changes:

    Ø Auto Scale checkbox – automatic scale setting;

    Ø Minimum Value field – minimum coordinate value;

    Ø field Maximum Value – maximum value of the coordinate.

    Appearance tab

    The Appearance tab contains groups (Fig. 37):

    Ø Fill Options – setting parameters for painting surfaces and contour lines;

    Ø Line Options – setting parameters for displaying lines and their coloring;

    Ø Point Options – set options for representing points with different symbols and their coloring.

    Rice. 6.13. Formation 3

    Each group has switches for selecting a Colormap or Solid Color color scheme.

    Lighting tab

    Here you can set the lighting effect of a 3D surface. This often gives such objects a more realistic appearance. You can enable lighting (Enable Lighting checkbox) and select a lighting scheme. It is possible to set the parameters of the illuminator (including those remote to infinity), take into account the differential

    fusion of light, and also select some other parameters.

    Backplanes tab

    There are three tabs with parameters for formatting the edges of a three-dimensional drawing: XY–Backplane, YZ–Backplane and XZ–Backplane. There are two main checkboxes on these tabs:

    Ø Fill Backplane – fills the corresponding face;

    Ø Backplane Border—sets the edge framing.

    In addition, there are groups of parameters for specifying a grid on faces: Grid (Grid) and Subgrid (Subgrid). When you set colors, a color selection dialog box appears.

    Special tab

    This tab is used to set various special effects. The settings on this tab are context sensitive, so they can only be changed for certain types of graphics. For example, access to the parameters of the Var Plot Layout group is possible only for histograms, that is (see the General tab above) only when the Var Plot switch is selected on the General tab.

    Advanced tab

    The most important parameters are collected in the Advanced View Options group:

    Ø Enable Fog – enable the fog effect;

    Ø Perspective – displays the surface in perspective;

    Ø Vertical Scale – setting the vertical scale;

    Ø Viewing Distance – set the distance from which the figure is viewed.

    QuickPlot Data Tab

    It allows you to configure basic parameters for quickly constructing three-dimensional graphs without specifying matrices of applicate surfaces. There are three groups of parameters here: Range 1 – setting limits for one parameter; Range 2 – setting limits for another parameter; Coordinate System – select one of three coordinate systems. .