vb畫tan函數圖像


vb畫tan函數圖像


答案補充:Cot函數這樣修改即可 。主要是你沒有定義y的類型 。至于fi*pi/180與fi有什么區別,那要根據你的fi單位而定 。如果你是以角度輸入的,那么應該加上*pi/180,如果本身是以弧度輸入的,就直接寫fi即可 。====================Private Sub Command1_Click()Dim x As Single, y As Single Picture1.Scale (-15, 15)-(15, -15)For x = -15 To 15 Step 0.001w = 1y = 1 / (Tan(w * x))Picture1.PSet (x, y), RGB(0, 255, 0)Next xEnd Sub===================建一個Command1,Picture1,Combo1.使用的時候,請先在Combo1中選擇或者輸入tan,然后單擊按鈕 。代碼如下 。================= Const pi = 3.14159265 Private Sub Command1_Click() Dim x As Single, y As Single, w As Single, fi As Single If Combo1.Text = "tan" Then w = 1 fi = 0 Picture1.Scale (-15, 15)-(15, -15) For x = -15 To 15 Step 0.001 y = Tan(w * x + fi) Picture1.PSet (x, y), RGB(0, 255, 0) Next x End If End Sub
【vb畫tan函數圖像】

    猜你喜歡