無需專業數學軟件,Excel 就可以繪製數學方程式圖像(建議收藏)

Sheets("作圖數據").Rows("2:1048576").Clear

With obReg

.Global = True

.IgnoreCase = True

.Pattern = "[x]"

End With

Sheets("作圖數據").Cells(2, 1).FormulaR1C1 = "=方程式!R2C2"

Sheets("作圖數據").Cells(3, 1).FormulaR1C1 = "=R[-1]C+方程式!R2C4"

Sheets("作圖數據").Cells(3, 1).AutoFill Destination:=Sheets("作圖數據").Range(Sheets("作圖數據").Cells(3, 1), Sheets("作圖數據").Cells(length + 2, 1))

For i = 0 To 9

Sheets("作圖數據").Cells(2, 2 + i).FormulaR1C1 = "=" & obReg.Replace(Sheets("方程式").Cells(2 + i, 1).Value, "RC[-" & i + 1 & "]")

Sheets("作圖數據").Range(Sheets("作圖數據").Cells(2, 2 + i), Sheets("作圖數據").Cells(2, 2 + i)).AutoFill Destination:=Sheets("作圖數據").Range(Sheets("作圖數據").Cells(2, 2 + i), Sheets("作圖數據").Cells(length + 2, 2 + i))

Next

ActiveWorkbook.Names.Add Name:="X_1", RefersToR1C1:="=OFFSET(作圖數據!R1C1,0,0,方程式!R2C7,1)"

For j = 1 To 10

ActiveWorkbook.Names.Add Name:="Y_" & j, RefersToR1C1:="=OFFSET(作圖數據!R1C" & j + 1 & ",0,0,方程式!R2C7,1)"

Next

Sheets("方程式").ChartObjects("圖表 3").Activate

ActiveChart.Axes(xlValue).Select

ActiveChart.Axes(xlValue).MinimumScale = Sheets("方程式").Range("e2").Value

ActiveChart.Axes(xlValue).MaximumScale = Sheets("方程式").Range("f2").Value

ActiveChart.Axes(xlValue).MajorUnit = Sheets("方程式").Range("E5").Value

ActiveChart.Axes(xlValue).MinorUnit = Sheets("方程式").Range("F5").Value

ActiveChart.Axes(xlCategory).Select

ActiveChart.Axes(xlCategory).MinimumScale = Sheets("方程式").Range("b2").Value

ActiveChart.Axes(xlCategory).MaximumScale = Sheets("方程式").Range("c2").Value

ActiveChart.Axes(xlCategory).MajorUnit = Sheets("方程式").Range("C5").Value

ActiveChart.Axes(xlCategory).MinorUnit = Sheets("方程式").Range("D5").Value

End Sub

步驟四:

在方程式表中插入兩個宏按鈕,具體操作如下:

無需專業數學軟件,Excel 就可以繪製數學方程式圖像(建議收藏)

插入按鈕(窗體控件)

完成後效果如下:

無需專業數學軟件,Excel 就可以繪製數學方程式圖像(建議收藏)

完成效果圖

步驟五:

將控件按鈕分別對應關聯到我們剛才粘貼的兩段代碼:

無需專業數學軟件,Excel 就可以繪製數學方程式圖像(建議收藏)

單擊右鍵指定宏

無需專業數學軟件,Excel 就可以繪製數學方程式圖像(建議收藏)

關聯對應的宏

步驟六:

大功告成!只需在方程式一欄中填寫自己想要作圖的方程然後點擊作圖即可生成函數圖像。

注意:當改變X、Y軸範圍時點擊作圖按鈕,只是改變方程時點擊刷新按鈕!!!

無需專業數學軟件,Excel 就可以繪製數學方程式圖像(建議收藏)

注意事項

無需專業數學軟件,Excel 就可以繪製數學方程式圖像(建議收藏)

數學方程式圖像


由於頭條不能放置鏈接,如需要附件請私信我!



分享到:


相關文章: