我是新手,大家见笑了~我用vba编转桨式水轮机的特性曲线,如上传的图所示:横坐标634.2于5线没有交点,于是得到0,点就跑到坐标轴外面去了
zhuansu = TextBox31.Text
For k = 0 To zhuanjiao - 1
For i = 0 To kaidu(k) - 1
For j = 0 To shu(i, k) - 1 n11(i, j) = n(i, j, k) discharge(i, j) = q11(i, j, k) kai(i, j) = a0(i, j, k)
Next j
Dim points(0 To 2001) As Double Dim f As Double Dim p As Double, q1 As Double
p = 600 / (qmax - qmin) q1 = 350 / (a0max - a0min)
For l = 0 To shu(i, k) - 1 discharge1(l) = discharge(i, l) n11a(l) = n11(i, l) Next l
If n11a(0) <= zhuansu And zhuansu <= n11a(shu(i, k) - 1) Then
'------------------------------------------利用反插值函数求出单位转速对应的单位流量值 x1(i) = xfactor(discharge1(), n11a(), shu(i, k) - 1, zhuansu, discharge1(0), discharge1(shu(i, k) - 1)) y1(i) = kai(i, 0) pt1(0) = (x1(i) - qmin) * p pt1(1) = (kai(i, 0) - a0min) * q1 pt1(2) = 0
Set circleobj = ThisDrawing.ModelSpace.AddCircle(pt1, 2)
End If
Next i For i = 0 To kaidu(k) - 1
f = (x1(kaidu(k) - 1) - x1(0)) / 1000
m = 0
For e = 0 To 1000 points(m) = (x1(0) + e * f - qmin) * p points(m + 1) = (TPspline(x1(), y1(), kaidu(k) - 1, x1(0) + e * f) - a0min) * q1
m = m + 2 Next e Set plineobj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points) plineobj.Lineweight = acLnWt040 Next i
pt1(0) = (x1(0) - qmin) * p - 5 pt1(1) = (kai(0, 0) - a0min) * q1 + 8 pt1(2) = 0 x = k + 1 Set textobj = ThisDrawing.ModelSpace.AddText(Str$(x), pt1, 5)
If x1(0) <= xlq(k) <= x1(kaidu(k) - 1) Then
xla(k) = xfactor(y1(), x1(), kaidu(k) - 1, xlq(k), y1(0), y1(kaidu(k) - 1)) End If
If xlq(k) < x1(0) Then ?????????? End If
Next k
这就不会编了,想延长曲线求其交点的横坐标。 |