当前位置:网站首页>How does matlab draw the curve of known formula and how does excel draw the function curve image?

How does matlab draw the curve of known formula and how does excel draw the function curve image?

2022-04-23 17:09:00 Hua Weiyun

Friends must encounter the problem of drawing function curves ! If you want to draw a function curve quickly and accurately , Can use EXCEL The chart function of , It can make your curves both standard and beautiful . You can also put multiple function images into the same chart for comparison . As shown in the figure below, it is in Excel Positive drawn in 、 Cosine function image :

dd6ca2a747c3b3a36615bf91319501d0.png

One 、 Prepare the data

1、 First, according to the function expression Prepare a set of data , Then use the data to draw the function image in the chart . In this example, the data is placed in the area A:C In the column , among A The value in the column is the value of the function argument , stay A Column A1 Cell input "X=", Indicates that this is an independent variable ,A2、A3 And the following cells, input each value of the independent variable from small to large , When actually entering , The input method of equal difference sequence is usually used . How to determine the initial value of the independent variable , Value range , What is the step size between data points , This is to judge according to the specific characteristics of the function . If you want to quickly find the extreme value of the function or see its development trend , The given data points do not have to be equal difference , Can be given as needed . Pictured , The value range I use for drawing is [-6,6], The interval between values is “0.1”.

a7d37c6ea91a38b32021a1ac084921bd.png

2、B Column sum C List the values of the two function variables . stay B Column B1 General written expression of cell input function ,y=sin(x), You can add some descriptive characters ; stay B2 Enter the formula according to the function expression in the cell “=SIN(A2)” Then select B2 Cell , Fill drop-down . Also in C Column input function expression and formula . Pictured , So the data is ready .

bce3f1d9b9bbde5647b417ec43213f56.png

Two 、 Draw function image

1、 Select... In the ribbon “ Insert ” tab , stay “ Chart ” Click... In the group “ Scatter plot → Scatter with smooth lines ”.

4a4df4df4486615e826817d0824057d5.png

2、Excel Insert into the chart area as shown in the figure below , And add the function of chart tool in the function area “ Design ”、“ Layout ”“ Format ” tab .

a1688815112709f6d3797f900595a773.png

3、 First, select the data of the chart , Right click in the chart area , Choose... From the shortcut menu that pops up “ Select data ”.

c2b88d15c73be22c36417bc4d72ce91f.png

4、 In the pop-up “ Select data source ” Select... In the dialog box “ add to ”, eject “ Edit data series ” Dialog box , Pictured , Choose the data we have prepared , spot “ determine ”. So the sine function image is added , Also add the cosine function .

b0bba089940eba534a1859f86ee45ead.png

5、 After adding the data function, the image will come out , Pictured , We found that there were many places that didn't meet the requirements , What needs to be revised .

3564d8a80ffaa61ea96b1a2cbaf09a03.png

6、 First, the legend and grid lines , We don't need to , You can delete . Select the legend in the chart , Press Delete Key delete , Then select the grid line , Press Delete Key delete .

315ab6db7171dda627e036fbae7e8a46.png

7、 Secondly, the scale of the two coordinate axes does not meet the requirements , In order to better adjust the coordinate axis , First, set the chart area to square , stay “ Format ” tab “ size ” In the group , Adjust the height and width to the same .

09a25697808cc849c16a625bcc706e03.png

8、 Right click on each coordinate axis , Choose... From the shortcut menu that pops up “ Format axis ”.

83018d0ea184130a257e99d45c6ab002.png

9、 In the pop-up “ Format axis ” In the dialog box “ Axis options ” In the column , take “ minimum value ”、“ Maximum ”、“ Main scale unit ” Is set to “ Fix ”, And enter... In the following text boxes “-6”、“6”、“1”, single click “ close ” Button . The two axes are set in the same way .

8c12acbaa95ecea967862fc6fb762c1f.png

10、 then , After setting the line color and linetype of the function image , Right click the function image , Choose... From the shortcut menu that pops up “ Format data series ”.

9d508741449e911f4f129956866d55b2.png

11、 In the pop-up “ Format data series ” In the dialog box “ line color ”、“ Linetype ” In the column , Set the line color and linetype of the function image respectively .

fadb41ff10dabc89a3022a07bf089f4a.png

12、 Finally, add a function expression to each image , First click to select a function image , Then click on a data point to select a data point , Right click on the data point , Choose... From the shortcut menu that pops up “ Add data label ”.

e1461c1c384a472c825fed2f75147752.png

13、 Then right click on the data point , Choose... From the shortcut menu that pops up “ Format data labels ”.

05ed533797b6548c40cdc5dd0430f7db.png

14、 In the pop-up “ Format data labels ” In the dialog box , Set the contents of the function label respectively 、 Position and border color, etc .

90619b743d4b9adf80d29400b4643b4e.png

dd605060c655810e69fb4f2d54619235.png

15、 At this point, the standard and beautiful function image is set up . The following is my parabola function image .

56376a0b36d34c3ab76f6af38c0e9b2d.png

版权声明
本文为[Hua Weiyun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231707302162.html