| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1141 人关注过本帖
标题:VB画曲线这些后面语句哪里有问题,为啥出现越界错误
取消只看楼主 加入收藏
我爱问
Rank: 2
等 级:论坛游民
帖 子:9
专家分:10
注 册:2016-5-4
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:1 
VB画曲线这些后面语句哪里有问题,为啥出现越界错误
Option Explicit
Private Sub Command1_Click()
Dim i As Integer, n As Integer
Dim C(100, 2000) As Double
Dim xd As Double: Dim λ As Double: Dim Id As Double: Dim I1 As Double
Dim φ As Double: Dim ρ As Double: Dim L As Double: Dim C0 As Double
Dim K1 As Double: Dim K2 As Double: Dim Crd As Double
Dim a As Double, b As Double
L = 100
λ = 1
xd = 0.01
Id = 0.002
φ = 0.21
ρ = 2.65
C0 = 10
K1 = 0.1
K2 = 0.1
Crd = 1
b = K1 / K2
a = b * Crd
For n = 0 To 1999 Step 1
If n = 0 Then
         C(i, n) = 0
         Else
    For i = 1 To 100
    If i = 1 Then
    C(i, n + 1) = (1 + (λ / L) * (4 * C(2, n) - C(3, n)) / (2 * xd)) / (1 + (3 * λ / L) / (2 * xd))
    ElseIf i = 100 Then
    C(i, n + 1) = (4 * C(i - 1, n + 1) - C(i - 2, n + 1)) / 3
    Else
    I1 = Id / (1 + ((1 - φ) / φ) * ρ * (a / ((1 + b * C0 * C(i, n)) ^ 2)))
    C(i, n + 1) = (C(i - 1, n + 1) * (λ / (L * xd ^ 2) + 1 / (2 * xd)) + C(i, n) * (-λ / (L * xd ^ 2) + 1 / (xd * 2) + 1 / I1) + C(i + 1, n) * (λ / (L * xd ^ 2) - 1 / (2 * xd))) / (λ / (L * xd ^ 2) + 1 / (2 * xd) + 1 / I1)
    End If
  Next i
End If
Next n
With MSChart1 '设置MSChart1
        .ColumnCount = 1 '图上只画一条曲线
        .chartType = VtChChartType2dLine '设置图表类型为二维曲线;默认为直方图
        .RowCount = 25 'X轴显示10个单位
End With
With MSChart1 ' 显示曲线
For n = 1 To 2000 Step 100
            .Row = n * 0.002 ' 指定X轴的坐标
            .RowLabel = n * 0.002 ' X轴标签
            .Data = C(100, n) ' 与x对应的值
Next n
End With
End Sub
这些后面语句哪里有问题,为啥出现越界错误?
2016-05-11 16:03
我爱问
Rank: 2
等 级:论坛游民
帖 子:9
专家分:10
注 册:2016-5-4
收藏
得分:0 
我试试,谢谢啦
2016-05-12 10:16
快速回复:VB画曲线这些后面语句哪里有问题,为啥出现越界错误
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015550 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved