| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 862 人关注过本帖
标题:求助!我编的程序,有问题!!给点修改,谢谢
只看楼主 加入收藏
AN玉蝴蝶
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2008-4-9
收藏
 问题点数:0 回复次数:6 
求助!我编的程序,有问题!!给点修改,谢谢
我们的课程设计,做了好久,还是没有做到满意,三角波不行呀!望高手给点建议呀,帮忙改一下了,明天久要交了!
呜呜~~~~

Const pi = 3.14159

    Dim a
    Dim m
    Dim k
    Dim wor
    Dim d As Double, f As Double
     
Sub XY()                                           '建立直角坐标系
    Picture1.Cls
     Picture1.ScaleMode = 0
     Picture1.ScaleMode = 3
     Picture1.Scale (-10, 10)-(10, -10)            '设置绘线宽度
     Picture1.DrawWidth = 1                        '绘坐标系的X轴及箭头线
     
     Picture1.Line (-10, 0)-(10, 0), vbBlue
     Picture1.Line (9, 0.5)-(10, 0), vbBlue
     Picture1.Line -(9, -0.5), vbBlue
     Picture1.ForeColor = vbBlue
     Picture1.Print "X/t"                             '绘坐标系的Y轴及箭头线

     Picture1.Line (0, 10)-(0, -10), vbBlue
     Picture1.Line (0.5, 9)-(0, 10), vbBlue
     Picture1.Line -(-0.5, 9), vbBlue
     Picture1.Print "Y/V"

     Picture1.CurrentX = -0.5                  '指定Y标值
     Picture1.CurrentY = -0.2
     Picture1.Print "O"
     
     Picture1.CurrentX = -0.5
     Picture1.CurrentY = 1
     Picture1.Print "1"

     Picture1.CurrentX = -0.5
     Picture1.CurrentY = 2
     Picture1.Print "2"
     
     Picture1.CurrentX = -0.5
     Picture1.CurrentY = 3
     Picture1.Print "3"
     
     Picture1.CurrentX = -0.5
     Picture1.CurrentY = 4
     Picture1.Print "4"
     
     Picture1.CurrentX = -0.5
     Picture1.CurrentY = 5
     Picture1.Print "5"
     
     Picture1.CurrentX = -0.5
     Picture1.CurrentY = 6
     Picture1.Print "6"
     
     Picture1.CurrentX = -0.5
     Picture1.CurrentY = 7
     Picture1.Print "7"
     
     Picture1.CurrentX = -0.5
     Picture1.CurrentY = 8
     Picture1.Print "8"
     
     
     
     Picture1.CurrentX = -0.5
     Picture1.CurrentY = -1
     Picture1.Print "-1"

     Picture1.CurrentX = -0.5
     Picture1.CurrentY = -2
     Picture1.Print "-2"
     
     Picture1.CurrentX = -0.5
     Picture1.CurrentY = -3
     Picture1.Print "-3"
     
     Picture1.CurrentX = -0.5
     Picture1.CurrentY = -4
     Picture1.Print "-4"
     
     Picture1.CurrentX = -0.5
     Picture1.CurrentY = -5
     Picture1.Print "-5"
     
     Picture1.CurrentX = -0.5
     Picture1.CurrentY = -6
     Picture1.Print "-6"
     
     Picture1.CurrentX = -0.5
     Picture1.CurrentY = -7
     Picture1.Print "-7"
     
     Picture1.CurrentX = -0.5
     Picture1.CurrentY = -8
     Picture1.Print "-8"
     
     Picture1.CurrentX = 1                  '指定X标值
     Picture1.CurrentY = -0.5
     Picture1.Print "1"
     
     Picture1.CurrentX = 2
     Picture1.CurrentY = -0.5
     Picture1.Print "2"
     
     Picture1.CurrentX = 3
     Picture1.CurrentY = -0.5
     Picture1.Print "3"
     
     Picture1.CurrentX = 4
     Picture1.CurrentY = -0.5
     Picture1.Print "4"
     
     Picture1.CurrentX = 5
     Picture1.CurrentY = -0.5
     Picture1.Print "5"
     
     Picture1.CurrentX = 6
     Picture1.CurrentY = -0.5
     Picture1.Print "6"
     
     Picture1.CurrentX = 7
     Picture1.CurrentY = -0.5
     Picture1.Print "7"
     
     Picture1.CurrentX = 8
     Picture1.CurrentY = -0.5
     Picture1.Print "8"
         
     Picture1.CurrentX = -1
     Picture1.CurrentY = -0.5
     Picture1.Print "-1"
     
     Picture1.CurrentX = -2
     Picture1.CurrentY = -0.5
     Picture1.Print "-2"
     
     Picture1.CurrentX = -3
     Picture1.CurrentY = -0.5
     Picture1.Print "-3"
     
     Picture1.CurrentX = -4
     Picture1.CurrentY = -0.5
     Picture1.Print "-4"
     
     Picture1.CurrentX = -5
     Picture1.CurrentY = -0.5
     Picture1.Print "-5"
     
     Picture1.CurrentX = -6
     Picture1.CurrentY = -0.5
     Picture1.Print "-6"
     
     Picture1.CurrentX = -7
     Picture1.CurrentY = -0.5
     Picture1.Print "-7"
     
     Picture1.CurrentX = -8
     Picture1.CurrentY = -0.5
     Picture1.Print "-8"
     
     Picture1.CurrentX = -9
     Picture1.CurrentY = -0.5
     Picture1.Print "-9"
     
     Picture1.CurrentX = -10
     Picture1.CurrentY = -0.5
     Picture1.Print "-10"
     
     
  End Sub

Private Sub Command1_Click()              '画正弦曲线

     d = Text1
     f = Text2
     k = Text3
     
     XY

     Picture1.DrawWidth = k             '重设绘线宽度
                                               
                                               '用For循环绘点,使其按正弦规律变化。步长值很小,使其形成动画效果
     For a = -10 To 9 Step pi / 6000
     Picture1.PSet (a, d * Sin(f * a * 6)), vbRed

     Next

                                              '指定位置显示描述文字
     Picture1.CurrentX = pi / 2
     Picture1.CurrentY = -7
     Picture1.ForeColor = vbBlack
     Picture1.Print "正弦波"

    End Sub

Private Sub Command2_Click()

     d = Text1
     f = Text2
     k = Text3
     
     XY

    Picture1.DrawWidth = k                 '重设绘线宽度
     
    For X = -10 To 9 Step pi / 6000
        m = Sin(2 * pi * f * X + q)
    If m > 0 Then Picture1.PSet (X, d), vbBlue
    If m < 0 Then Picture1.PSet (X, -d)
    Next
   
    Picture1.CurrentX = pi / 2
    Picture1.CurrentY = -7
    Picture1.ForeColor = vbBlack
    Picture1.Print "矩形波"
End Sub

Private Sub Command3_Click()
     d = Text1
     f = Text2
     k = Text3
     
    XY

    Picture1.DrawWidth = k                 '重设绘线宽度
     
    For X = -10 To 9 Step pi / 6000
        m = Sin(2 * pi * f * X)
   
        If m > 0 Then
           w = w + pi / 6000
        Else
           w = w - pi / 6000
        End If
        Picture1.PSet (X, d * w), vbGreen
   Next
 
   
    Picture1.CurrentX = pi / 2
    Picture1.CurrentY = -7
    Picture1.ForeColor = vbBlack
    Picture1.Print "三角波"
End Sub

Private Sub Command4_Click()

  End

End Sub
搜索更多相关主题的帖子: Dim Double 课程 坐标系 
2008-04-22 22:26
AN玉蝴蝶
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2008-4-9
收藏
得分:0 
怎么都没有人回复呀!!!!

相濡以沫?相忘于江湖?
2008-04-23 09:17
??
Rank: 1
等 级:新手上路
帖 子:68
专家分:0
注 册:2007-11-24
收藏
得分:0 
所有波形都不对
2008-04-23 09:27
AN玉蝴蝶
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2008-4-9
收藏
得分:0 
???别吓唬我呀!我下午就要交了

相濡以沫?相忘于江湖?
2008-04-23 09:33
AN玉蝴蝶
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2008-4-9
收藏
得分:0 
怎么就没有人给出一点我能用得上的意见呢?

相濡以沫?相忘于江湖?
2008-04-23 12:02
slore
Rank: 5Rank: 5
等 级:贵宾
威 望:16
帖 子:1108
专家分:0
注 册:2005-7-1
收藏
得分:0 
代码长……坐标貌似可以循环下……

你要提出什么建议?
三角波可以显示出来呀!

快上课了……
2008-04-23 12:22
AN玉蝴蝶
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2008-4-9
收藏
得分:0 
回复 6# 的帖子
可是只在上半轴呀!而且频率大了也不行呀

相濡以沫?相忘于江湖?
2008-04-23 13:30
快速回复:求助!我编的程序,有问题!!给点修改,谢谢
数据加载中...
 
   



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

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