1 / 7

问题:画正弦函数图象

问题:画正弦函数图象. 设有函数 y=Sin(x) 试编程序,画出- 10<x<10 时的函数图象。. Private Sub Command1_Click() Dim x As Single, y As Single ‘ 定义变量 Picture1.Scale (-10, 10)-(10, -10) ' 定义坐标系 Picture1.Cls ' 清除图片框的输出内容

kaycee
Download Presentation

问题:画正弦函数图象

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 问题:画正弦函数图象 设有函数 y=Sin(x)试编程序,画出-10<x<10时的函数图象。

  2. Private Sub Command1_Click() Dim x As Single, y As Single ‘定义变量 Picture1.Scale (-10, 10)-(10, -10) '定义坐标系 Picture1.Cls '清除图片框的输出内容 Picture1.Line (-10, 0)-(10, 0), RGB(0, 0, 255) '画x轴 Picture1.Line (0, 10)-(0, -10), RGB(0, 0, 255) '画y轴 For x = -10 To 10 Step 0.0001 '循环控制 y = Sin(x) '求函数值 Picture1.PSet (x, y), RGB(255, 0, 0) '描点画图 Next x End Sub

  3. 程序中的第二语句: Scale (-10,10)-(10,-10) 中两个点的坐标分别定义了屏幕窗口左上角和右下角的逻辑坐标,所定义坐标系x和y的取值范围分别为[-10,10],该坐标系中点的坐标可以按该范围上逻辑坐标给出,系统会将屏幕上点的逻辑坐标转换成屏幕的物理坐标,无须人为干预。

  4. 10 y 0 15480 x -10 10 x 0 -10 y 物理坐标系 逻辑坐标系 Scale (-10,10)-(10,-10) 11190

  5. 程序执行的结果如下图。

  6. 练习:将 定义为函数, 并画出函数图象。

  7. 操作: 1.画函数 的图象。 (振幅a ,在程序执行时从键盘输入) 2.画函数 的图象。 (振幅a和周期b从键盘输入) 3.画函数 的图象。 (振幅a、周期b和位移c都从键盘输入) 4.将以上程序改为画余弦函数图象 的程序。

More Related