版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
北京邮电大学2013年计算机实习报告2011211205王旋北京邮电大学计算机实习报告学院:电子工程学院班号:2011211205学号:2011210986姓名:王旋目录TOC\o"1-3"\h\u2064目录 07402一、题目设计 176101、方差均值器 129796(1)语言选择: 124450(2)原始设计思路 18581(3)实际设计改进及框图 18028(4)程序运行界面 5123923、数字信号处理器 66913(1)程序使用语言 62474框图如下图5所示: 723361(5)编程感悟 8212454、多米诺骨牌动画 95812(1)使用软件 914714(2)原始设计思路 931574(3)实际设计改进 97024(4)动画效果截图 1075595.模拟信号发生器 1130144(1)使用语言 11135(2)原始设计思路 1122793(3)实际设计改进及框图 122928(4)程序运行界面 133367(5)关于演示时报错的说明及编程感悟 145929二、题目心得汇总 1432224三、程序源代码汇总 15258471、方差均值器 1586192、数字波形生成器 1727093、数字信号处理器 37214915、函数信号发生器 402037四、实习总结 509806五、文献资料 50
一、题目设计1、方差均值器设计一个平均值计数器,有一个输入窗口,可迅速算出输入的一系列数字的平均值和方差;同时支持加载外部文本,可算出文本中列出数字的平均值和方差。(1)语言选择:visualbasic6.0中文企业版(2)原始设计思路运行exe程序后,出现界面包含文本框、四个CommandButton和结果显示区。其中文本框可接收直接输入信息;CommandButton分别是计算、载入、清除和退出,完成Click事件后,分别进行相应操作。计算结果会在显示区显示,而文本打开用Showopen,载入读取时使用循环+条件,只将符合数字ASICII码的进行载入并运算。点击清除按钮会清除文本框内信息和结果显示区内容。点击退出则结束程序。此外,可适当对其进行外观美化。(3)实际设计改进及框图载入文本用的是CommonDialog,选定文件后将文件路径赋值给一个字符变量,而后用Open函数提取其内容。读取数据时用split函数,遇到“”则将值赋给Text1.text。框图如下图1:图1.方差均值器程序框图(4)程序运行界面如下图2,输入数据后即可进行运算,也可选择载入文本或清除数据最后点退出程序则结束。图2.程序运行界面2、数字波形生成器给出数字序列A,B的值和逻辑函数F的表达式(与,或,非,异或,同或等),生成A,B和F的波形图。注:A,B序列可任意长度。(1)语言选择:visualbasic6.0中文企业版(2)原始设计思路exe文件运行后会左半部分有两个文本框(A、B),五种CommandButton(与、或、非、异或、同或运算符),实际运算公式(F=A_B);右半部分分别是A、B、F波形生成显示按钮和清除、退出按钮。分别选择五种CommandButton时,实际运算公式会出现作出相应显示,再点击波形生成会进行相应的运算(若A、B长度不一致,则空余部分置0)并通过PictureBox显示波形结果。波形绘制可通过PictureBox中的Line控件实现,且考虑到A、B序列为任意长度,生成的波形最好在弹出的对话框中出现,并附上ScrollBalls2水平滚动效果。实际设计改进及框图框图如下图3。图3.数字波生成器程序框图坐标的自动变换最后没有选择滚动效果,而是将坐标随输入数据的数量进行自动调整,即:将坐标用未知数定义。程序运行时,开始读取数据时用的是数值,而后将其转换为boolean代数,这样用户即使输入非01的数也可以进行运算了。(4)程序运行界面如下图4,输入数据点击相应选项即可进行相应运算,如果没有数据输入也会进行报错。图4.程序运行界面(5)编程感悟如果绘制图像类型时的选项用OptionButton完成,而不是靠分别建立不同的CommandButton控制,坐标建立时就可以使用相同代码,能使代码长度在很大程度上减小。在编程时应该加强对这一点的控制,尽量将可以共同使用的代码提取到全局中,简化代码。3、数字信号处理器由数字信号处理原理可知:计算有限长数字序列线性卷积的公式为:若则取设计程序求出:1)输出y(n)的值2)在图形方式下以x轴为n,y轴分别为x(n),h(n),y(n)画出其关系图(图上x轴单位长度可取5point,y轴单位长度可取20point)(1)程序使用语言Visualbasic6.0中文企业版(2)原始设计思路主界面包含y(n)显示部分,三个PictureBox坐标图显示部分以及生成波形、清除波形和退出程序的三个CommandButton按钮。运算时程序分为[0,9],[10,19],[19,35](n>19时波形都为0,不必全部显示画出)。坐标图可使用Line和Shape控件实现,通过循环语句连续画点,实现图像显示。清除时将图像置为“”即可。(3)实际设计改进及框图框图如下图5所示:图5.数字信号处理程序框图(4)程序运行界面图6.数字波生成器运行界面(5)编程感悟如果对程序出点的图进行美化则程序会好很多。此外,应该再对y输出值进行合适的排版。但是因为当时时间紧迫并未实行,这点很遗憾。
4、多米诺骨牌动画每个同学自己设计一个多米诺骨牌动画,时长不少于60秒。(1)使用软件3dsmax2013(2)原始设计思路
动画具体效果及创新性的剧情想法会在成品中展示,下面先介绍一下用该软件实现多米诺骨牌的基本思路:先制作并导出SD格式的场景,并将其导入RF中结算。在MAX中制作一个平面和一列骨牌模型,将一侧的牌稍微倾斜。将牌保存并导入到RF中,对其进行动力学操作,添加刚体重力使其在重力下运动。结算时当一张牌开始压到另一张牌时,在MAX中改变两者距离,通过重力值调节倒下速度。将SD文件生成关键帧,并可对已有动画进行适当的调节复制,使其达到所需时长。(3)实际设计改进主要是为了延长时长、改善效果而使用了两个摄像机,增强动感。而后用绘声绘影进行了剪辑。这里需注意,3dsmax导出视频是avi格式,而绘声绘影不能对avi进行处理,于是还需要用格式工厂或其他小插件转换一下。(4)动画效果截图(如下图7所示)图7.domino动画效果开始界面5.模拟信号发生器题目要求:1)调制方式:幅度调制,频率调制。模拟信号和载波信号的频率,幅值可变。调制信号频率,幅值可变。2)画出信号波形。3)对该信号采样,并做文件存入磁盘中。4)可以适用多种调制方式。(1)使用语言Visualbasic中文企业版(2)原始设计思路主界面左半部分包括可选择正弦、方波、三角波三种波形,幅度调制、频率调制、直流偏置的三个输入文本框。右半部分则有波形显示部分和绘制、采样、保存、重置、退出五个CommandButton。使用幅度调制可通过乘上输入常数实现,频率调制是通过乘上合适的正弦函数对波形进行频域搬移实现的,而直流偏置的添加只需要在每点加上固定的某一直流数值即可。采样采用时域抽样,使用循环,可输入采样频率(若不输入则执行默认的采样值)。重选则回到程序起始未进行任何选择的地方,退出则会关闭程序。绘图使用Line、Shape控件,各种调制命令若没有输入值则都按制定的默认数值进行处理。每次绘制波形都会重新将左半部分四个数据读取一次,若未选择波形类型则弹出对话框报错。保存可用Showsave语句保存Picture。(3)实际设计改进及框图实际在设计时用了OptionButton进行了波形选择,通过输入原始信号机调谐信号的幅度、频率进行运算绘图。图8.函数信号发生器程序框图
(4)程序运行界面图9.1函数信号发生器运行界面图9.2函数信号发生器采样界面(5)关于演示时报错的说明及编程感悟如前面数字波形生成那道题一样,如果将能公用的语句提取出来设成全局变量会很大程度上减小代码长度。此外,这道题我在验收时遇到了问题,无法生成三个基础波形,报错是“除数为0”,当初自己调试时并未如此,但是我很快地找到了问题所在。为了能使作出的图形美观,我的坐标参数都是以未知数定义的,其中生成波形时选取的周期数是以调谐函数周期数为标准的,这样在计算周期时T=2*pi/w2(w2为调谐函数输入频率)。若没有输入,则除数为0运算不能进行。事实上,我开始调试时已经对此进行排查,在程序开头有ifw2=0则使用w1进行坐标周期显示数定义的判断语句。但是不知道为什么展示的时候出现了错误。此处粘贴的源代码为我重新调试修改过的源代码,应该没有问题。二、题目心得汇总为了实现某种功能而编写程序时,应该将具体的问题抽象成机器容易实现的算法,然后用汇编语言将其具现化。应该摈弃一些自己解决问题的办法而多向机器语言靠拢,利用已有的知识将其整合成能达成目的、实现功能的源代码。编程时程序调试真的需要足够的耐心并要保持冷静。而且有时候,同样的功能,不同的人写出来就会很不一样。虽然我实现了题目中所要求的功能,但是我的语句明显太过冗余。这可能是因为对函数的掌握不够多,编程经验太少,缺乏编程技巧。此外,我认为修改程序代码时很容易“牵一发而动全身”,所以修改语句时一定要小心谨慎,我的最后一道题验收时出现错误很有可能就是这个原因,不过我已经对其进行了调整和修正。在动画制作方面,我不得不承认,有时一个题目的实现并不是单纯考验你的技术是否过硬,还可以是你的美工、创意、艺术细胞等。如果说在前面的编程题里能体现创意的点比较少的话,这道题中你就可以获得足够的发展空间了。可惜的是,我在编程上花费的时间太多,后期有些捉襟见肘,动画被放倒了最后做,于是略显仓促。不过好在能将软件的功能都实现了,虽然后期用视频剪辑软件处理过了,但总体效果比起那些花费上时间做的同学还是差太多。三、程序源代码汇总1、方差均值器PrivateSubCommand1_Click()IfText1.Text=""Then'判断文本框是否为空MsgBox"youhavn'tputonnumber!",5+16+256,"error"ElseDimaa=Split(Text1.Text,"")DimbDimnumAsIntegernum=UBound(a)'读取文本框内数据ReDimb(0ToUBound(a))AsSingleDimiAsIntegerFori=0ToUBound(b)b(i)=Val(a(i))NextiDimaveAsSingleDimsquAsSingleDimjAsIntegerave=0Forj=0Tonumave=ave+b(j)Ifj=numThenave=ave/(num+1)'计算平均值ExitForEndIfNextjsqu=0Forj=0Tonumsqu=squ+(b(j)-ave)*(b(j)-ave)Ifj=numThensqu=squ/(num+1)'计算方差ExitForEndIfNextjText2.Text=aveText3.Text=squEndIfEndSubPrivateSubCommand2_Click()DimsAsStringDimstrAsStringCommonDialog1.ShowOpenOpen(CommonDialog1.FileName)ForInputAs#1IfNotEOF(1)ThenInput#1,s'载入文本EndIfWhileNotEOF(1)s=s&vbCrLfInput#1,strs=s&strWendClose#1Text1.Text=sEndSubPrivateSubCommand3_Click()Text1.Text=""Text2.Text=""'清除功能Text3.Text=""EndSubPrivateSubCommand4_Click()End'退出程序EndSubPrivateSubForm_Load()Me.Picture=LoadPicture("D:\20130322vb\2.jpg")EndSub'载入背景2、数字波形生成器PrivateSubCommand1_Click()IfText1.Text=""ThenMsgBox"youhavn'tputonnumber!",5+16+256,"error"ElseDimaa=Split(Text1.Text,"")DimbReDimb(0ToUBound(a))AsIntegerDimiAsIntegerFori=0ToUBound(b)b(i)=Val(a(i))Ifb(i)<>0Thenb(i)=1EndIfNextiEndIfDimnumAsIntegernum=UBound(b)+1DimfReDimf(0Tonum-1)AsIntegerFori=0To(num-1)f(i)=b(i)NextiPicture1.Scale(-1,5)-(num+2,-1)'定义坐标系Picture1.Line(0,0)-(num+1,0)'x轴Picture1.Line(num+1,0)-(num+1-0.5,0.1)'上箭头Picture1.Line(num+1,0)-(num+1-0.5,-0.1)'下箭头Picture1.Print"x轴"Picture1.Line(0,0)-(0,4)'y轴Picture1.Line(0,4)-(-0.1,3.7)'左箭头Picture1.Line(0,4)-(0.1,3.7)'右箭头Picture1.Print"y轴"DimnAsIntegerForn=0TonumPicture1.Line(n,0)-(n,0.4)Picture1.CurrentX=n:Picture1.CurrentY=-0.2:Picture1.Printn'横坐标标点NextnPicture1.Line(0,2)-(0.1,2)Picture1.CurrentX=-0.4:Picture1.CurrentY=1.5:Picture1.Print0Picture1.Line(0,1)-(0.1,1)Picture1.CurrentX=-0.4:Picture1.CurrentY=2.5:Picture1.Print1'纵坐标标点Iff(0)=1ThenPicture1.Line(0,2)-(1,2)Picture1.CurrentY=2ElsePicture1.Line(0,1)-(1,1)Picture1.CurrentY=1EndIfFori=0Tonum-2Iff(i)<f(i+1)ThenPicture1.Line(i+1,1)-(i+1,2)Picture1.Line(i+1,2)-(i+2,2)Picture1.CurrentY=2ElseIff(i)>f(i+1)ThenPicture1.Line(i+1,2)-(i+1,1)Picture1.Line(i+1,1)-(i+2,1)Picture1.CurrentY=1ElsePicture1.Line(i+1,Picture1.CurrentY)-(i+2,Picture1.CurrentY)EndIfNextiEndSubPrivateSubCommand10_Click()Label9.Caption="A同或B"IfText1.Text=""ThenMsgBox"youhavn'tputonnumber!",5+16+256,"error"ElseDima1'获取text1的值a1=Split(Text1.Text,"")Dimb1ReDimb1(0ToUBound(a1))AsBooleanDimiAsIntegerFori=0ToUBound(b1)b1(i)=Val(a1(i))Ifb1(i)<>0Thenb1(i)=1EndIfNextiEndIfIfText2.Text=""Then'获取text2的值MsgBox"youhavn'tputonnumber!",5+16+256,"error"ElseDima2a2=Split(Text2.Text,"")Dimb2ReDimb2(0ToUBound(a2))AsBooleanFori=0ToUBound(b2)b2(i)=Val(a2(i))Ifb2(i)<>0Thenb2(i)=1EndIfNextiEndIfDimnumAsIntegerDimnum1AsIntegernum1=UBound(b1)+1Dimnum2AsIntegernum2=UBound(b2)+1Ifnum1>num2Then'对两文本长度进行大小比较,将短缺者赋值为0num=num1Fori=num2+1TonumReDimPreserveb2(i)b2(i)=0NextiElseIfnum1<num2Thennum=num2Fori=num1+1TonumReDimPreserveb1(i)b1(i)=0NextiElse:num=num1EndIfDimgReDimg(0Tonum-1)AsBooleanFori=0To(num-1)g(i)=(b1(i)Eqvb2(i))'进行逻辑运算NextiDimfReDimf(0Tonum-1)AsIntegerFori=0To(num-1)If(g(i))Thenf(i)=1Else:f(i)=0'进行运算结果赋值EndIfNextiPicture3.Scale(-1,5)-(num+2,-1)'定义坐标系Picture3.Line(0,0)-(num+1,0)'x轴Picture3.Line(num+1,0)-(num+1-0.5,0.1)'上箭头Picture3.Line(num+1,0)-(num+1-0.5,-0.1)'下箭头Picture3.Print"x轴"Picture3.Line(0,0)-(0,4)'y轴Picture3.Line(0,4)-(-0.1,3.7)'左箭头Picture3.Line(0,4)-(0.1,3.7)'右箭头Picture3.Print"y轴"DimnAsIntegerForn=0TonumPicture3.Line(n,0)-(n,0.4)Picture3.CurrentX=n:Picture3.CurrentY=-0.2:Picture3.Printn'横坐标标点NextnPicture3.Line(0,2)-(0.1,2)Picture3.CurrentX=-0.4:Picture3.CurrentY=1.5:Picture3.Print0Picture3.Line(0,1)-(0.1,1)Picture3.CurrentX=-0.4:Picture3.CurrentY=2.5:Picture3.Print1'纵坐标标点Iff(0)=1ThenPicture3.Line(0,2)-(1,2)'画第一点Picture3.CurrentY=2ElsePicture3.Line(0,1)-(1,1)Picture3.CurrentY=1EndIfFori=0Tonum-2Iff(i)<f(i+1)ThenPicture3.Line(i+1,1)-(i+1,2)Picture3.Line(i+1,2)-(i+2,2)'画后部分点Picture3.CurrentY=2ElseIff(i)>f(i+1)ThenPicture3.Line(i+1,2)-(i+1,1)Picture3.Line(i+1,1)-(i+2,1)Picture3.CurrentY=1ElsePicture3.Line(i+1,Picture3.CurrentY)-(i+2,Picture3.CurrentY)EndIfNextiEndSubPrivateSubCommand11_Click()Label9.Caption="非A"IfText1.Text=""ThenMsgBox"youhavn'tputonnumber!",5+16+256,"error"ElseDima1'获取text1的值a1=Split(Text1.Text,"")Dimb1ReDimb1(0ToUBound(a1))AsBooleanDimiAsIntegerFori=0ToUBound(b1)b1(i)=Val(a1(i))Ifb1(i)<>0Thenb1(i)=1EndIfNextiEndIfDimnumAsIntegerDimnum1AsIntegernum1=UBound(b1)+1num=num1DimgReDimg(0Tonum-1)AsBooleanFori=0To(num-1)g(i)=(Notb1(i))'进行逻辑运算NextiDimfReDimf(0Tonum-1)AsIntegerFori=0To(num-1)If(g(i))Thenf(i)=1Else:f(i)=0'进行运算结果赋值EndIfNextiPicture3.Scale(-1,5)-(num+2,-1)'定义坐标系Picture3.Line(0,0)-(num+1,0)'x轴Picture3.Line(num+1,0)-(num+1-0.5,0.1)'上箭头Picture3.Line(num+1,0)-(num+1-0.5,-0.1)'下箭头Picture3.Print"x轴"Picture3.Line(0,0)-(0,4)'y轴Picture3.Line(0,4)-(-0.1,3.7)'左箭头Picture3.Line(0,4)-(0.1,3.7)'右箭头Picture3.Print"y轴"DimnAsIntegerForn=0TonumPicture3.Line(n,0)-(n,0.4)Picture3.CurrentX=n:Picture3.CurrentY=-0.2:Picture3.Printn'横坐标标点NextnPicture3.Line(0,2)-(0.1,2)Picture3.CurrentX=-0.4:Picture3.CurrentY=1.5:Picture3.Print0Picture3.Line(0,1)-(0.1,1)Picture3.CurrentX=-0.4:Picture3.CurrentY=2.5:Picture3.Print1'纵坐标标点Iff(0)=1ThenPicture3.Line(0,2)-(1,2)'画第一点Picture3.CurrentY=2ElsePicture3.Line(0,1)-(1,1)Picture3.CurrentY=1EndIfFori=0Tonum-2Iff(i)<f(i+1)ThenPicture3.Line(i+1,1)-(i+1,2)Picture3.Line(i+1,2)-(i+2,2)'画后部分点Picture3.CurrentY=2ElseIff(i)>f(i+1)ThenPicture3.Line(i+1,2)-(i+1,1)Picture3.Line(i+1,1)-(i+2,1)Picture3.CurrentY=1ElsePicture3.Line(i+1,Picture3.CurrentY)-(i+2,Picture3.CurrentY)EndIfNextiEndSubPrivateSubCommand12_Click()Label9.Caption="非B"IfText1.Text=""ThenMsgBox"youhavn'tputonnumber!",5+16+256,"error"ElseDima2a2=Split(Text2.Text,"")Dimb2ReDimb2(0ToUBound(a2))AsBooleanFori=0ToUBound(b2)b2(i)=Val(a2(i))Ifb2(i)<>0Thenb2(i)=1EndIfNextiEndIfDimnumAsIntegerDimnum2AsIntegernum2=UBound(b2)+1num=num2DimgReDimg(0Tonum-1)AsBooleanFori=0To(num-1)g(i)=(Notb2(i))'进行逻辑运算NextiDimfReDimf(0Tonum-1)AsIntegerFori=0To(num-1)If(g(i))Thenf(i)=1Else:f(i)=0'进行运算结果赋值EndIfNextiPicture3.Scale(-1,5)-(num+2,-1)'定义坐标系Picture3.Line(0,0)-(num+1,0)'x轴Picture3.Line(num+1,0)-(num+1-0.5,0.1)'上箭头Picture3.Line(num+1,0)-(num+1-0.5,-0.1)'下箭头Picture3.Print"x轴"Picture3.Line(0,0)-(0,4)'y轴Picture3.Line(0,4)-(-0.1,3.7)'左箭头Picture3.Line(0,4)-(0.1,3.7)'右箭头Picture3.Print"y轴"DimnAsIntegerForn=0TonumPicture3.Line(n,0)-(n,0.4)Picture3.CurrentX=n:Picture3.CurrentY=-0.2:Picture3.Printn'横坐标标点NextnPicture3.Line(0,2)-(0.1,2)Picture3.CurrentX=-0.4:Picture3.CurrentY=1.5:Picture3.Print0Picture3.Line(0,1)-(0.1,1)Picture3.CurrentX=-0.4:Picture3.CurrentY=2.5:Picture3.Print1'纵坐标标点Iff(0)=1ThenPicture3.Line(0,2)-(1,2)'画第一点Picture3.CurrentY=2ElsePicture3.Line(0,1)-(1,1)Picture3.CurrentY=1EndIfFori=0Tonum-2Iff(i)<f(i+1)ThenPicture3.Line(i+1,1)-(i+1,2)Picture3.Line(i+1,2)-(i+2,2)'画后部分点Picture3.CurrentY=2ElseIff(i)>f(i+1)ThenPicture3.Line(i+1,2)-(i+1,1)Picture3.Line(i+1,1)-(i+2,1)Picture3.CurrentY=1ElsePicture3.Line(i+1,Picture3.CurrentY)-(i+2,Picture3.CurrentY)EndIfNextiEndSubPrivateSubCommand2_Click()IfText2.Text=""ThenMsgBox"youhavn'tputonnumber!",5+16+256,"error"ElseDimaa=Split(Text2.Text,"")DimbReDimb(0ToUBound(a))AsIntegerDimiAsIntegerFori=0ToUBound(b)b(i)=Val(a(i))Ifb(i)<>0Thenb(i)=1EndIfNextiEndIfDimnumAsIntegernum=UBound(b)+1DimfReDimf(0Tonum-1)AsIntegerFori=0To(num-1)f(i)=b(i)NextiPicture2.Scale(-1,5)-(num+2,-1)'定义坐标系Picture2.Line(0,0)-(num+1,0)'x轴Picture2.Line(num+1,0)-(num+1-0.5,0.1)'上箭头Picture2.Line(num+1,0)-(num+1-0.5,-0.1)'下箭头Picture2.Print"x轴"Picture2.Line(0,0)-(0,4)'y轴Picture2.Line(0,4)-(-0.1,3.7)'左箭头Picture2.Line(0,4)-(0.1,3.7)'右箭头Picture2.Print"y轴"DimnAsIntegerForn=0TonumPicture2.Line(n,0)-(n,0.4)Picture2.CurrentX=n:Picture2.CurrentY=-0.2:Picture2.Printn'横坐标标点NextnPicture2.Line(0,2)-(0.1,2)Picture2.CurrentX=-0.4:Picture2.CurrentY=1.5:Picture2.Print0Picture2.Line(0,1)-(0.1,1)Picture2.CurrentX=-0.4:Picture2.CurrentY=2.5:Picture2.Print1'纵坐标标点Iff(0)=1ThenPicture2.Line(0,2)-(1,2)Picture2.CurrentY=2ElsePicture2.Line(0,1)-(1,1)Picture2.CurrentY=1EndIfFori=0Tonum-2Iff(i)<f(i+1)ThenPicture2.Line(i+1,1)-(i+1,2)Picture2.Line(i+1,2)-(i+2,2)Picture2.CurrentY=2ElseIff(i)>f(i+1)ThenPicture2.Line(i+1,2)-(i+1,1)Picture2.Line(i+1,1)-(i+2,1)Picture2.CurrentY=1ElsePicture2.Line(i+1,Picture2.CurrentY)-(i+2,Picture2.CurrentY)EndIfNextiEndSubPrivateSubCommand3_Click()Label9.Caption="A与B"IfText1.Text=""ThenMsgBox"youhavn'tputonnumber!",5+16+256,"error"ElseDima1'获取text1的值a1=Split(Text1.Text,"")Dimb1ReDimb1(0ToUBound(a1))AsBooleanDimiAsIntegerFori=0ToUBound(b1)b1(i)=Val(a1(i))Ifb1(i)<>0Thenb1(i)=1EndIfNextiEndIfIfText2.Text=""Then'获取text2的值MsgBox"youhavn'tputonnumber!",5+16+256,"error"ElseDima2a2=Split(Text2.Text,"")Dimb2ReDimb2(0ToUBound(a2))AsBooleanFori=0ToUBound(b2)b2(i)=Val(a2(i))Ifb2(i)<>0Thenb2(i)=1EndIfNextiEndIfDimnumAsIntegerDimnum1AsIntegernum1=UBound(b1)+1Dimnum2AsIntegernum2=UBound(b2)+1Ifnum1>num2Then'对两文本长度进行大小比较,将短缺者赋值为0num=num1Fori=num2+1TonumReDimPreserveb2(i)b2(i)=0NextiElseIfnum1<num2Thennum=num2Fori=num1+1TonumReDimPreserveb1(i)b1(i)=0NextiElse:num=num1EndIfDimgReDimg(0Tonum-1)AsBooleanFori=0To(num-1)g(i)=(b1(i)Andb2(i))'进行逻辑运算NextiDimfReDimf(0Tonum-1)AsIntegerFori=0To(num-1)If(g(i))Thenf(i)=1Else:f(i)=0'进行运算结果赋值EndIfNextiPicture3.Scale(-1,5)-(num+2,-1)'定义坐标系Picture3.Line(0,0)-(num+1,0)'x轴Picture3.Line(num+1,0)-(num+1-0.5,0.1)'上箭头Picture3.Line(num+1,0)-(num+1-0.5,-0.1)'下箭头Picture3.Print"x轴"Picture3.Line(0,0)-(0,4)'y轴Picture3.Line(0,4)-(-0.1,3.7)'左箭头Picture3.Line(0,4)-(0.1,3.7)'右箭头Picture3.Print"y轴"DimnAsIntegerForn=0TonumPicture3.Line(n,0)-(n,0.4)Picture3.CurrentX=n:Picture3.CurrentY=-0.2:Picture3.Printn'横坐标标点NextnPicture3.Line(0,2)-(0.1,2)Picture3.CurrentX=-0.4:Picture3.CurrentY=1.5:Picture3.Print0Picture3.Line(0,1)-(0.1,1)Picture3.CurrentX=-0.4:Picture3.CurrentY=2.5:Picture3.Print1'纵坐标标点Iff(0)=1ThenPicture3.Line(0,2)-(1,2)'画第一点Picture3.CurrentY=2ElsePicture3.Line(0,1)-(1,1)Picture3.CurrentY=1EndIfFori=0Tonum-2Iff(i)<f(i+1)ThenPicture3.Line(i+1,1)-(i+1,2)Picture3.Line(i+1,2)-(i+2,2)'画后部分点Picture3.CurrentY=2ElseIff(i)>f(i+1)ThenPicture3.Line(i+1,2)-(i+1,1)Picture3.Line(i+1,1)-(i+2,1)Picture3.CurrentY=1ElsePicture3.Line(i+1,Picture3.CurrentY)-(i+2,Picture3.CurrentY)EndIfNextiEndSubPrivateSubCommand4_Click()Picture1.ClsEndSubPrivateSubCommand5_Click()Picture2.ClsEndSubPrivateSubCommand6_Click()Picture3.ClsEndSubPrivateSubCommand7_Click()EndEndSubPrivateSubCommand8_Click()Label9.Caption="A异或B"IfText1.Text=""ThenMsgBox"youhavn'tputonnumber!",5+16+256,"error"ElseDima1'获取text1的值a1=Split(Text1.Text,"")Dimb1ReDimb1(0ToUBound(a1))AsBooleanDimiAsIntegerFori=0ToUBound(b1)b1(i)=Val(a1(i))Ifb1(i)<>0Thenb1(i)=1EndIfNextiEndIfIfText2.Text=""Then'获取text2的值MsgBox"youhavn'tputonnumber!",5+16+256,"error"ElseDima2a2=Split(Text2.Text,"")Dimb2ReDimb2(0ToUBound(a2))AsBooleanFori=0ToUBound(b2)b2(i)=Val(a2(i))Ifb2(i)<>0Thenb2(i)=1EndIfNextiEndIfDimnumAsIntegerDimnum1AsIntegernum1=UBound(b1)+1Dimnum2AsIntegernum2=UBound(b2)+1Ifnum1>num2Then'对两文本长度进行大小比较,将短缺者赋值为0num=num1Fori=num2+1TonumReDimPreserveb2(i)b2(i)=0NextiElseIfnum1<num2Thennum=num2Fori=num1+1TonumReDimPreserveb1(i)b1(i)=0NextiElse:num=num1EndIfDimgReDimg(0Tonum-1)AsBooleanFori=0To(num-1)g(i)=(b1(i)Xorb2(i))'进行逻辑运算NextiDimfReDimf(0Tonum-1)AsIntegerFori=0To(num-1)If(g(i))Thenf(i)=1Else:f(i)=0'进行运算结果赋值EndIfNextiPicture3.Scale(-1,5)-(num+2,-1)'定义坐标系Picture3.Line(0,0)-(num+1,0)'x轴Picture3.Line(num+1,0)-(num+1-0.5,0.1)'上箭头Picture3.Line(num+1,0)-(num+1-0.5,-0.1)'下箭头Picture3.Print"x轴"Picture3.Line(0,0)-(0,4)'y轴Picture3.Line(0,4)-(-0.1,3.7)'左箭头Picture3.Line(0,4)-(0.1,3.7)'右箭头Picture3.Print"y轴"DimnAsIntegerForn=0TonumPicture3.Line(n,0)-(n,0.4)Picture3.CurrentX=n:Picture3.CurrentY=-0.2:Picture3.Printn'横坐标标点NextnPicture3.Line(0,2)-(0.1,2)Picture3.CurrentX=-0.4:Picture3.CurrentY=1.5:Picture3.Print0Picture3.Line(0,1)-(0.1,1)Picture3.CurrentX=-0.4:Picture3.CurrentY=2.5:Picture3.Print1'纵坐标标点Iff(0)=1ThenPicture3.Line(0,2)-(1,2)'画第一点Picture3.CurrentY=2ElsePicture3.Line(0,1)-(1,1)Picture3.CurrentY=1EndIfFori=0Tonum-2Iff(i)<f(i+1)ThenPicture3.Line(i+1,1)-(i+1,2)Picture3.Line(i+1,2)-(i+2,2)'画后部分点Picture3.CurrentY=2ElseIff(i)>f(i+1)ThenPicture3.Line(i+1,2)-(i+1,1)Picture3.Line(i+1,1)-(i+2,1)Picture3.CurrentY=1ElsePicture3.Line(i+1,Picture3.CurrentY)-(i+2,Picture3.CurrentY)EndIfNextiEndSubPrivateSubCommand9_Click()Label9.Caption="A或B"IfText1.Text=""ThenMsgBox"youhavn'tputonnumber!",5+16+256,"error"ElseDima1'获取text1的值a1=Split(Text1.Text,"")Dimb1ReDimb1(0ToUBound(a1))AsBooleanDimiAsIntegerFori=0ToUBound(b1)b1(i)=Val(a1(i))Ifb1(i)<>0Thenb1(i)=1EndIfNextiEndIfIfText2.Text=""Then'获取text2的值MsgBox"youhavn'tputonnumber!",5+16+256,"error"ElseDima2a2=Split(Text2.Text,"")Dimb2ReDimb2(0ToUBound(a2))AsBooleanFori=0ToUBound(b2)b2(i)=Val(a2(i))Ifb2(i)<>0Thenb2(i)=1EndIfNextiEndIfDimnumAsIntegerDimnum1AsIntegernum1=UBound(b1)+1Dimnum2AsIntegernum2=UBound(b2)+1Ifnum1>num2Then'对两文本长度进行大小比较,将短缺者赋值为0num=num1Fori=num2+1TonumReDimPreserveb2(i)b2(i)=0NextiElseIfnum1<num2Thennum=num2Fori=num1+1TonumReDimPreserveb1(i)b1(i)=0NextiElse:num=num1EndIfDimgReDimg(0Tonum-1)AsBooleanFori=0To(num-1)g(i)=(b1(i)Orb2(i))'进行逻辑运算NextiDimfReDimf(0Tonum-1)AsIntegerFori=0To(num-1)If(g(i))Thenf(i)=1Else:f(i)=0'进行运算结果赋值EndIfNextiPicture3.Scale(-1,5)-(num+2,-1)'定义坐标系Picture3.Line(0,0)-(num+1,0)'x轴Picture3.Line(num+1,0)-(num+1-0.5,0.1)'上箭头Picture3.Line(num+1,0)-(num+1-0.5,-0.1)'下箭头Picture3.Print"x轴"Picture3.Line(0,0)-(0,4)'y轴Picture3.Line(0,4)-(-0.1,3.7)'左箭头Picture3.Line(0,4)-(0.1,3.7)'右箭头Picture3.Print"y轴"DimnAsIntegerForn=0TonumPicture3.Line(n,0)-(n,0.4)Picture3.CurrentX=n:Picture3.CurrentY=-0.2:Picture3.Printn'横坐标标点NextnPicture3.Line(0,2)-(0.1,2)Picture3.CurrentX=-0.4:Picture3.CurrentY=1.5:Picture3.Print0Picture3.Line(0,1)-(0.1,1)Picture3.CurrentX=-0.4:Picture3.CurrentY=2.5:Picture3.Print1'纵坐标标点Iff(0)=1ThenPicture3.Line(0,2)-(1,2)'画第一点Picture3.CurrentY=2ElsePicture3.Line(0,1)-(1,1)Picture3.CurrentY=1EndIfFori=0Tonum-2Iff(i)<f(i+1)ThenPicture3.Line(i+1,1)-(i+1,2)Picture3.Line(i+1,2)-(i+2,2)'画后部分点Picture3.CurrentY=2ElseIff(i)>f(i+1)ThenPicture3.Line(i+1,2)-(i+1,1)Picture3.Line(i+1,1)-(i+2,1)Picture3.CurrentY=1ElsePicture3.Line(i+1,Picture3.CurrentY)-(i+2,Picture3.CurrentY)EndIfNextiEndSubPrivateSubForm_Load()Me.Picture=LoadPicture("D:\20130322vb\2.jpg")EndSub3、数字信号处理器PrivateSubCommand1_Click()DimiAsIntegerDimnAsIntegerPicture1.Scale(-1,5)-(20,-1)'定义坐标系Picture1.Line(0,0)-(19,0)'x轴Picture1.Line(19,0)-(18.5,0.1)'上箭头Picture1.Line(19,0)-(18.5,-0.1)'下箭头Picture1.Print"x轴"Picture1.Line(0,0)-(0,4)'y轴Picture1.Line(0,4)-(-0.1,3.7)'左箭头Picture1.Line(0,4)-(0.1,3.7)'右箭头Picture1.Print"y轴"Fori=0To9xi=1Picture1.PSet(i,1),vbBlack'画x(n)的图像NextiForn=0To9Picture1.Line(n,0)-(n,0.1)Picture1.CurrentX=n:Picture1.CurrentY=-0.2:Picture1.PrintnNextnPicture1.Line(0,1)-(0.2,1)EndSubPrivateSubCommand2_Click()DimiAsIntegerDimnAsIntegerPicture2.Scale(-1,14)-(22,-1)Picture2.Line(0,0)-(21,0)Picture2.Line(21,0)-(20.5,0.5)Picture2.Print"x轴"Picture2.Line(21,0)-(20.5,-0.5)Picture2.Line(0,0)-(0,13)Picture2.Line(0,13)-(-0.5,12.5)Picture2.Line(0,13)-(0.5,12.5)Picture2.Print"y轴"Forn=0To20Picture2.PSet(n,n/2),vbBlack'画h(n)的图像NextnForn=0To20Step2Picture2.Line(n,0)-(n,0.3)Picture2.CurrentX=n:Picture2.CurrentY=0:Picture2.PrintnNextnForn=1To12Step2Picture2.Line(0,n)-(0.4,n)Picture2.CurrentX=-0.2:Picture2.CurrentY=n:Picture2.PrintnNextnEndSubPrivateSubCommand3_Click()Picture3.Scale(-1,80)-(44,-5)Picture3.Line(0,0)-(44,0)Picture3.Line(44,0)-(43.5,0.5)Picture3.Print"x轴"Picture3.Line(44,0)-(43.5,-0.5)Picture3.Line(0,0)-(0,80)Picture3.Line(0,80)-(-0.5,79.5)Picture3.Line(0,80)-(0.5,79.5)Picture3.Print"y轴"Forn=0To28Sum=0Form=0TonIfm<=9Thenxn=1Elsexn=0EndIfIf(n-m)<=19Thenhn=0.5*(n-m)Elsehn=0EndIfSum=Sum+xn*hnNextmPicture3.PSet(n,Sum),vbBlackNextnForn=0To40Step4Picture3.Line(n,0)-(n,1)Picture3.CurrentX=n:Picture3.CurrentY=0:Picture3.PrintnNextnForn=1To77Step5Picture3.Line(0,n)-(0.4,n)Picture3.CurrentX=-0.2:Picture3.CurrentY=n:Picture3.PrintnNextnEndSubPrivateSubCommand4_Click()Forn=0To28Sum=0Form=0TonIfm<=9Thenxn=1Elsexn=0EndIfIfn-m<=19Thenhn=0.5*(n-m)Elsehn=0EndIfSum=Sum+xn*hnNextmLabel7.Caption=Label7.Caption+"y("+Format(n)+")="+Format(Sum)+";"'输出y(n)的值Label7.Font.Size=11Label7.Font.Bold=TrueNextnEndSubPrivateSubCommand5_Click()Picture1.ClsEndSubPrivateSubCommand6_Click()Picture2.ClsEndSubPrivateSubCommand7_Click()Picture3.ClsEndSubPrivateSubCommand8_Click()Label7.Caption=""EndSubPrivateSubCommand9_Click()EndEndSubPrivateSubForm_Load()Me.Picture=LoadPicture("D:\20130322vb\2.jpg")EndSub5、函数信号发生器Dima1,a2,w1,w2,d,A,tAsDoubleDimL,H,T1AsSingleConstpi=3.14159PrivateSubCommand1_Click()Picture1.Clsa1=Val(Text1.Text)a2=Val(Text3.Text)w1=Val(Text2.Text)w2=Val(Text4.Text)d=Val(Text5.Text)Ifa2=0Thena2=1EndIfIfOption1.ValueThenIfw2=0Then'判断w2是否为0L=6ElseL=2*pi*4/w2EndIfIfd<0ThenMsgBox"请输入合法的直流偏置!",5+16+256,"error"'判断的d是否为负ElseH=1.5*Abs(a1)*Abs(a2)+Abs(d)Picture1.Scale(-1,H+1)-(L+2,-H)'定义坐标系Picture1.Line(0,0)-(L+1,0)'x轴Picture1.Line(L+1,0)-(L+1-0.5,0.1)'上箭头Picture1.Line(L+1,0)-(L+1-0.5,-0.1)'下箭头Picture1.Print"时间/t"Picture1.Line(0,-H)-(0,H)'y轴Picture1.Lin
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024年商品期货居间代理服务佣金结算合同3篇
- 2024买卖公寓合同签订实务:合同签订与房产交接流程2篇
- 2024年度出口代理合同:国内生产企业与外贸公司关于产品出口的代理协议3篇
- 2024三七种植基地与电商平台联合营销合同3篇
- 2024年度墙壁刮仿瓷产品出口许可合同3篇
- 2024年度中小企业贷款合同样本3篇
- 2024企业宣传片制作与专业设备租赁合同3篇
- 2024版出租车车辆租赁与保险综合服务合同
- 2024年车位租赁与增值服务合同3篇
- 酱料研发合同范例
- 脉冲振荡肺功能简介课件
- 第三方支付合作协议
- Unit+6+Lesson+1+A+Medical+Pioneer+课件【 核心知识备课精研精讲】 高中英语北师大版(2019)必修第二册
- 安徽德隆泰化工有限公司年产3000吨246-三甲基苯甲酰氯、20000吨羟基乙酸项(18000吨70%的羟基乙酸产品和2000吨99%的羟基乙酸产品)环境影响报告书
- 幼儿园大班春季周计划表(整学期)
- 直燃机机组维护保养规程
- 【标准格式】有限空间告知牌(罐区储罐)
- 中国,全图及各省,地图透明,模版
- 2023吉首大学EDA试题
- 课程设计液溴储罐的设计
- 某车间梁模板扣件钢管高支撑架计算
评论
0/150
提交评论