'ctrl+t ==>microsoft scriptcontrol
option explicit
public y as
double
public x as
double
'引用
private
sub command1_click()
dim mathstr as
string
dim tmpstr as
string
onerror
resume next
mathstr = "2*(x^2)+3*(x)+23"
'定義乙個數學函式,可以能過textbox輸入,但是只能有乙個變數x.還要注意調整下面for迴圈中的範圍.例如:1/x.要保證x>0.
for x = -10 to 10 step 0.05
tmpstr = replace(ucase$(mathstr), "x", x) '替換掉原公式中的值
y = scriptcontrol1.eval(tmpstr) '根據表示式計算值.
'座標原點是500,500
picture1.currentx = 1000 + x * 15
picture1.currenty = 3000 - y * 15 '注意,電腦的y座標與數學座標是相反的.
picture1.print "."
next
endsub
Python動態繪製曲線
python動態繪製曲線 import numpy as np import matplotlib.pyplot as plt num 100index 0data np.zeros num 初始化 for i in range 10000 index index 0.1 adddata np.si...
用VB繪製正弦動畫曲線
用vb繪製正弦動畫曲線 vb提供了繪圖的基本方法,如pset line circle,能夠繪出點 直線 圓等基本圖形,但沒有提供繪曲線的方法。其實,我們可以靈活運用基本繪圖方法,來繪出所需要的曲線,甚至達到動畫的效果。一 vb座標系介紹 vb裡有三種座標系,螢幕座標系 窗體座標系和窗體內的物件座標系...
Qt繪製動態曲線
ifndef qlinewidget h define qlinewidget h include include include include include include include include include include include include include incl...