北京郵電大學電子工程學院計算機實習報告,題目基本歷年都一樣_第1頁
北京郵電大學電子工程學院計算機實習報告,題目基本歷年都一樣_第2頁
北京郵電大學電子工程學院計算機實習報告,題目基本歷年都一樣_第3頁
北京郵電大學電子工程學院計算機實習報告,題目基本歷年都一樣_第4頁
北京郵電大學電子工程學院計算機實習報告,題目基本歷年都一樣_第5頁
已閱讀5頁,還剩32頁未讀 繼續免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

暑期實習報告由數字信號處理原理可知:計算有限長數字序列線性卷積的公式為:則題目要求:(1)輸入N1,N2,輸出y(n)值(2)在圖形方式下以x軸為n,y軸分別為x(n)、h(n)、y(n)畫出其關系圖設計方案:使用編程語言為:MicrosoftVisualBasic開發工具為:MicrosoftVisualBasic6.0sp6中文企業版在Form1中進程編輯,利用五個CommandButton,分別控制x(n)、h(n)、y(n)的序列圖像輸出、y(n)序列輸出及清除功能,3個Picturebox用來顯示x(n)、h(n)、y(n)的坐標圖,Label用來表達所要操作的內容。定義兩個整型變量N1、N2,要想顯示其中的一個圖像時,先將所輸入的兩個值附給上述兩個變量,然后利用Picture.Scale與Picture.Line來畫坐標圖,最后通過for….next語句實現循環畫點,從而實現每個圖像的顯示。當想進行清除時只要再清除的CommandButton下輸入Picture.Cls、Label.Caption=""、Text.Text=""等語句即可。流程圖:開始開始定義變量N1,N2輸入兩個整形數分別賦值給N1,N2N1<=N2輸出x(n),h(n),y(n)的圖形按N1>N2的情況輸出y(n)輸出x(n),h(n),y(n)的圖形按N1<=N2的情況輸出y(n)結束源代碼:DimN1%,N2%PrivateSubCommand1_Click()N1=Int(Text1.Text):N2=Int(Text2.Text)Picture1.Scale(-1,20)-(20,-1)'畫x(n)坐標Picture1.Line(0,0)-(19,0)Picture1.Line(19,0)-(18.5,-0.5)Picture1.Line(19,0)-(18.5,0.5)Picture1.Line(0,0)-(0,19)Picture1.Line(0,19)-(0.5,18.5)Picture1.Line(0,19)-(-0.5,18.5)Fori=0ToN1xi=1Picture1.PSet(i,1),vbBlack'畫x(n)的圖像NextiForn=0ToN1Picture1.CurrentX=n:Picture1.CurrentY=0.4:Picture1.PrintnNextnEndSubPrivateSubCommand2_Click()N1=Int(Text1.Text):N2=Int(Text2.Text)Picture2.Scale(-1,20)-(20,-1)'畫h(n)坐標Picture2.Line(0,0)-(19,0)Picture2.Line(19,0)-(18.5,-0.5)Picture2.Line(19,0)-(18.5,0.5)Picture2.Line(0,0)-(0,19)Picture2.Line(0,19)-(0.5,18.5)Picture2.Line(0,19)-(-0.5,18.5)Forn=0ToN2Picture2.PSet(n,n/2),vbBlack'畫h(n)的圖像NextnForn=0ToN2Picture2.CurrentX=n:Picture2.CurrentY=0.4:Picture2.PrintnNextnndSubPrivateSubCommand3_Click()N1=Int(Text1.Text):N2=Int(Text2.Text)Picture3.Scale(-3,44)-(44,-3)Picture3.Line(0,0)-(44,0)Picture3.Line(44,0)-(43.5,-0.5)Picture3.Line(44,0)-(43.5,0.5)Picture3.Line(0,0)-(0,44)Picture3.Line(0,44)-(0.5,43.5)Picture3.Line(0,44)-(-0.5,43.5)Forn=0To(N1+N2)y=0Form=0TonIfm<=N1ThenXn=1ElseXn=0EndIfIf(n-m)<=N2ThenHn=0.5*(n-m)ElseHn=0EndIfy=y+Xn*HnNextmPicture3.PSet(n,y),vbBlackNextnForn=0ToN1+N2Picture3.CurrentX=n:Picture3.CurrentY=0.4:Picture3.PrintnNextnEndSubPrivateSubCommand4_Click()N1=Int(Text1.Text):N2=Int(Text2.Text)Forn=0To(N1+N2)y=0Form=0TonIfm<=N1ThenXn=1ElseXn=0EndIfIf(n-m)<=N2ThenHn=0.5*(n-m)ElseHn=0EndIfy=y+Xn*HnNextmLabel7.Caption=Label7.Caption+"y("+Format(n)+")="+Format(y)+""'輸出y(n)的值Label7.Font.Size=12NextnEndSubPrivateSubCommand5_Click()Picture1.ClsPicture2.ClsPicture3.ClsLabel7.Caption=""Text1.Text=""Text2.Text=""EndSub程序運行主界面截圖:功能介紹:當輸入N1,N2的值后,點擊X(n)序列圖,坐標圖中將顯示X(n)的坐標圖,點擊H(n)序列圖坐標圖中將顯示H(n)的坐標圖,點擊Y(n)序列圖將坐標圖中顯示Y(n)的序列圖并輸出Y(n)的值。清除可以清除掉當前輸入的N1,N2的值,保存具有保存當然坐標圖象的功能。題目要求:設計方案:使用編程語言為:MicrosoftVisualBasic開發工具為:MicrosoftVisualBasic6.0sp6中文企業版當輸入所要查詢的日期所在的年和月是否是閏年和閏月時,應先對其進行計算并判斷,然后分別顯示年和月是否為閏的情況并同時顯示輸入日期是星期幾。當輸入設置時間time1后,每當系統時間的增加1秒就和所設的時間比較一遍,直到相等時則開始執行所需任務,彈出對話框并進行聲音提醒,當點擊確認之后之后則整個提醒結束,并可以重新設置下個提醒任務。流程圖:開始開始定義變量year,month,day輸入三個整型數分別賦值給以上三個變量所賦的時間合理顯示所輸入日期所在的閏年、閏月的情況及是星期幾定義變量timeds1.text,time2.text輸入所設的時間并賦值給timeds1.text將系統的當前時間值賦給time2.texttimeds1.text=time2,text彈出提示框并運行聲音文件確認結束源代碼:PrivateSubnl1_Click()'設定鬧鈴1CommonDialog1.Filter="*.wav"'打開鈴聲文件CommonDialog1.ShowOpen'顯示打開對話框MMControl1.FileName=CommonDialog1.FileName'接收文件EndSubPrivateSubnl2_Click()CommonDialog2.Filter="*.wav"CommonDialog2.ShowOpenMMControl2.FileName=CommonDialog2.FileNameEndSubPrivateSubnl3_Click()CommonDialog3.Filter="*.wav"CommonDialog3.ShowOpenMMControl3.FileName=CommonDialog3.FileNameEndSubPrivateSubnl4_Click()CommonDialog4.Filter="*.wav"CommonDialog4.ShowOpenMMControl4.FileName=CommonDialog4.FileNameEndSubPrivateSubexit_Click()x=MsgBox("真的要退出嗎?",4+32+0,"退出系統")Ifx=6Then'點擊“是”,退出EndEndIfEndSubPrivateSubText2_Change()IfTextds1.Text=Text2.TextThen'當設定的時間與當時時間一樣時MMControl1.Command="open"'鬧鈴打開并播放MMControl1.Command="play"a=MsgBox(Textdingshi1.Text,0,"事件")'彈出對話框顯示事件提醒MMControl1.Command="stop"'點擊確定后鬧鈴關閉,同時設定的時間與事件一并清除Textds1.Text="輸入時間1"Textdingshi1.Text=""EndIfIfTextds2.Text=Text2.TextThenMMControl2.Command="open"MMControl2.Command="play"b=MsgBox(Textdingshi2.Text,0,"事件")Textds2.Text="輸入時間2"Textdingshi2.Text=""MMControl2.Command="stop"EndIfEndSubPrivateSubText3_change()'捕捉文本框內容的改變,立刻顯示是否閏年IfText3.Text=""ThenText4.Text="未輸入年份"Elsea=Val(Text3.Text)IfaMod100=0Then'當a被100整除時判斷是否也被400整除IfaMod400=0ThenText4.Text="是"'是則是閏年ElseText4.Text="否"'否則不是閏年EndIfElseIfaMod4=0Then'當a不被100整除時判斷是否被4整除Text4.Text="是"'是則是閏年ElseText4.Text="否"'否則不是閏年EndIfEndIfEndIfEndSubPrivateSubTimer1_Timer()Text1.Text=Date$'輸出日期Text2.Text=Format(Time,"ttttt")'輸出時間EndSub程序運行主界面截圖:功能介紹:可輸入的要查詢的年份是否為閏年并且題目要求:作一個兩輛賽車比賽的游戲,要求可以用A,S,D,W和小鍵盤的上下左右鍵控制小汽車的運行方向進行比賽。設計方案:所用軟件為MacromediaFlash8設置控制鍵,通過按鍵對小車進行控制,在控制的同時判斷小車的位置使其行駛在跑道上,當而這種有一個到達終點時,比賽結束,并輸出比賽結果。開始流程圖:開始方向鍵控制方向鍵控制小車停止小車停止對兩小車是否碰到跑道進行判斷對兩小車是否碰到跑道進行判斷YYNN判斷比賽是否完成判斷比賽是否完成NNYY顯示比賽的輸贏顯示比賽的輸贏結束結束源代碼:defs:car1.code="player1";car2.code="player2";acceleration=0.4;speedDecay=0.9;rotationStep=10;maxSpeed=10;backSpeed=2;actions:functionstep(who){ //checktoseeifthecarinquestioniscontrolledbytheplayerorbythecomputer if(_root["car"+who].code=="player2"){ //wewillconstantlydecreasespeedbymultiplyingitwithanumberbelow1 if(this["speed"+who]>0.3){ this["speed"+who]*=_root.speedDecay; }else{ this["speed"+who]=0; } //thecarwillreacttocertainkeys //accelerate if(Key.isDown(87)&&this["speed"+who]<_root.maxSpeed){ this["speed"+who]+=_root.acceleration; } //brake(reverse) if(Key.isDown(83)){ this["speed"+who]-=_root.backSpeed; } //steerleft if(Key.isDown(65)&&this["speed"+who]>0.3){ _root["car"+who]._rotation-=_root.rotationStep*(this["speed"+who]/_root.maxSpeed); } //steerright if(Key.isDown(68)&&this["speed"+who]>0.3){ _root["car"+who]._rotation+=_root.rotationStep*(this["speed"+who]/_root.maxSpeed); } this["rotation"+who]=_root["car"+who]._rotation; //wecalculatethetwocomponentsofspeed(XaxisandYaxis) this["speedx"+who]=Math.sin(this["rotation"+who]*(Math.PI/180))*this["speed"+who]; this["speedy"+who]=Math.cos(this["rotation"+who]*(Math.PI/180))*this["speed"+who]*-1; //applythecomponentsontheactualpositionofthecar _root["car"+who]._x+=this["speedx"+who]; _root["car"+who]._y+=this["speedy"+who]; if(_root["car"+who].hitTest(end)){ gotoAndPlay(3); }; if(_root["car"+who].hitTest(car1)){ this["speed"+who]=0; }; for(i=1;i<=17;i++){ if(_root["car"+who].hitTest(_root["bark"+i])){ this["speed"+who]=0; }; } if(_root["car"+who]._x<50){ this["speed"+who]=0;}; if(_root["car"+who]._x>1150){ this["speed"+who]=0;}; if(_root["car"+who]._y<50){ this["speed"+who]=0;}; if(_root["car"+who]._y>700){ this["speed"+who]=0;}; } if(_root["car"+who].code=="player1"){ //wewillconstantlydecreasespeedbymultiplyingitwithanumberbelow1 if(this["speed"+who]>0.3){ this["speed"+who]*=_root.speedDecay; }else{ this["speed"+who]=0; } //thecarwillreacttocertainkeys //accelerate if(Key.isDown(Key.UP)&&this["speed"+who]<_root.maxSpeed){ this["speed"+who]+=_root.acceleration; } //brake(reverse) if(Key.isDown(Key.DOWN)){ this["speed"+who]-=_root.backSpeed; } //steerleft if(Key.isDown(Key.LEFT)&&this["speed"+who]>0.3){ _root["car"+who]._rotation-=_root.rotationStep*(this["speed"+who]/_root.maxSpeed); } //steerright if(Key.isDown(Key.RIGHT)&&this["speed"+who]>0.3){ _root["car"+who]._rotation+=_root.rotationStep*(this["speed"+who]/_root.maxSpeed); } this["rotation"+who]=_root["car"+who]._rotation; //wecalculatethetwocomponentsofspeed(XaxisandYaxis) this["speedx"+who]=Math.sin(this["rotation"+who]*(Math.PI/180))*this["speed"+who]; this["speedy"+who]=Math.cos(this["rotation"+who]*(Math.PI/180))*this["speed"+who]*-1; //applythecomponentsontheactualpositionofthecar _root["car"+who]._x+=this["speedx"+who]; _root["car"+who]._y+=this["speedy"+who]; if(_root["car"+who].hitTest(end)){ gotoAndPlay(4); }; //shengli for(i=1;i<=17;i++){ if(_root["car"+who].hitTest(_root["bark"+i])){ this["speed"+who]=0; }; } if(_root["car"+who].hitTest(car2)){ this["speed"+who]=0; }; if(_root["car"+who]._x<50){ this["speed"+who]=0;}; if(_root["car"+who]._x>1150){ this["speed"+who]=0;}; if(_root["car"+who]._y<50){ this["speed"+who]=0;}; if(_root["car"+who]._y>700){ this["speed"+who]=0;}; }}程序運行主界面截圖:功能介紹:可進行兩輛賽車的比賽4、題目要求:設計一個成績管理系統,可添加、刪除、修改班級,科目、學生。可按照科目和學號組合查詢、可按照班級打印成績單(要求:可添加、刪除、修改班級,科目、學生,查詢、打印)設計方案:使用編程語言為:MicrosoftVisualBasic開發工具為:MicrosoftVisualBasic6.0sp6中文企業版對輸入的數據庫文件進行存儲,然后對其訪問即可開始流程圖:開始建立數據庫文件建立數據庫文件保存保存對選定的班級進行成績打印按科目和學號查找對數據庫文件進行修改操作對選定的班級進行成績打印按科目和學號查找對數據庫文件進行修改操作結束結束源代碼:窗體代碼:frmMainPrivateSubMDIForm_Load()Me.Width=Screen.Width*0.75Me.Height=Screen.Height*0.75Me.Left=Screen.Width*0.125Me.Top=Screen.Height*0.125Me.Show'總是將工作目錄設到應用程序所在目錄ChDirApp.Path'初始化文檔窗體數組,并顯示第一個子窗體ReDimDoc(1)ReDimFState(1)Doc(1).Tag=1FState(1).Dirty=FalseDoc(1).Caption="新成績表:1"Doc(1).Show'讀系統注冊表并適當地設置最近使用的菜單文件列表控件數組GetRecentFilesEndSubPrivateSubMDIForm_Unload(CancelAsInteger)IfNotAnyPadsLeft()ThenEndEndIfEndSubPrivateSubmnuFileExit_Click()EndEndSubPrivateSubmnuFileNew_Click()'調用FileNew過程FileNewEndSubPrivateSubmnuFileOpen_Click()'調用文件打開過程FileOpenProcEndSubPrivateSubmnuHelpAbout_Click()frmAbout.ShowvbModal,MeEndSubPrivateSubmnuhelpmain_Click()frmHelp.ShowvbModal,MeEndSubPrivateSubmnuRecentFile_click(IndexAsInteger)'調用文件打開過程,傳遞一個對選定文件名的引用OpenFile(mnuRecentFile(Index).Caption)'更新文件列表GetRecentFilesEndSubPrivateSubtbToolBar_ButtonClick(ByValButtonAsComctlLib.Button)'用SelectCase語句處理Key屬性,'以確定單擊了哪個按鈕。WithfrmMain.ActiveFormSelectCaseButton.KeyCase"new"'選擇新建FileNewCase"Open"'選擇打開FileOpenProcCase"Save"'選擇保存'檢測文件是否已經有了文件名DimstrFilenameAsStringIfLeft(frmMain.ActiveForm.Caption,4)="新成績表"ThenstrFilename=GetFileName(strFilename)ElsestrFilename=.CaptionEndIfIfstrFilename<>""ThenSaveFileAsstrFilename'調用文件保存過程EndIfCase"Print"'選擇打印filePrintJCase"Copy"'選擇復制a=.ChengJB.Rowb=.ChengJB.RowSelc=.ChengJB.Cold=.ChengJB.ColSelCopyThing(a),(b),(c),(d)Case"Edit"'選擇表元編輯.mnuEditBaoyuan.Checked=True.mnuEditKemu.Checked=False.mnuEditCheng.Checked=FalseCase"Hang"'選擇按行輸入.mnuEditBaoyuan.Checked=False.mnuEditKemu.Checked=False.mnuEditCheng.Checked=TrueCase"Lie"'選擇按列輸入.mnuEditBaoyuan.Checked=False.mnuEditKemu.Checked=True.mnuEditCheng.Checked=FalseCase"Big"'選擇字體放大FontChang(1)Case"Little"'選擇字體縮小FontChang(-1)Case"Up"'選擇升序排列.ChengJB.Sort=1Case"Down"'選擇降序排列.ChengJB.Sort=2Case"Shuxing"'選擇成績表屬性frmShuxing.ShowvbModal,frmMainEndSelectEndWithEndSub模塊代碼:Module1TypeformstateDeletedAsIntegerDirtyAsIntegerColorAsLongEndTypePublicFState()Asformstate'用戶自定義數組PublicDoc()AsNewfrmBG'子窗體對象數組PublicConstThisApp="管理系統"'定義ThisApp函數PublicConstThisKey="RecentFiles"'定義ThisKey函數SubMain()'啟動窗體frmSplash.ShowfrmSplash.RefreshEndSubFunctionAnyPadsLeft()AsInteger'檢測是否還有打開的子窗體DimiAsIntegerFori=1ToUBound(Doc)IfNotFState(i).DeletedThenAnyPadsLeft=TrueExitFunctionEndIfNextEndFunctionSubFileNew()'新建文件過程DimfIndexAsInteger'找到下一個可用的索引并顯示該子窗體fIndex=FindFreeIndex()Doc(fIndex).Tag=fIndexDoc(fIndex).Caption="新成績表:"&fIndexDoc(fIndex).ShowEndSubFunctionFindFreeIndex()AsInteger'空文件索引檢索過程DimiAsIntegerDimArrayCountAsIntegerArrayCount=UBound(Doc)Fori=1ToArrayCountIfFState(i).DeletedThenFindFreeIndex=iFState(i).Deleted=FalseExitFunctionEndIfNext'如果子窗體對象數組中沒有一個元素被刪除,'文檔數組與狀態數組均加1并返回新元素的索引(Index)。ReDimPreserveDoc(ArrayCount+1)ReDimPreserveFState(ArrayCount+1)FindFreeIndex=UBound(Doc)EndFunctionSubGetRecentFiles()'讀注冊表數據,更新“文件”菜單Dimi,jAsIntegerDimVarFilesAsVariant'用Getallsettings語句從注冊表中返回最近使用過的文件'常數ThisApp和ThisKey已在模塊中定義IfGetSetting(ThisApp,ThisKey,"Recentfile1")=EmptyThenExitSubVarFiles=GetAllSettings(ThisApp,ThisKey)Fori=0ToUBound(VarFiles,1)frmMain.mnuRecentFile(0).Visible=TruefrmMain.mnuRecentFile(i).Caption=VarFiles(i,1)frmMain.mnuRecentFile(i).Visible=True'更新所有子窗體的“文件”菜單Forj=1ToUBound(Doc)IfNotFState(j).DeletedThenDoc(j).mnuRecentFile(0).Visible=TrueDoc(j).mnuRecentFile(i+1).Caption=VarFiles(i,1)Doc(j).mnuRecentFile(i+1).Visible=TrueEndIfNextjNextiEndSubSubWriteRecentFiles(OpenFileName)'寫注冊表數據'本過程使用SaveSettings語句將最近使用的文件名寫入系統注冊表Dimi,jAsIntegerDimstrFile,KeyAsString'將文件RecentFile1復制給RecentFile2等等Fori=3To1Step-1Key="RecentFile"&istrFile=GetSetting(ThisApp,ThisKey,Key)IfstrFile<>""ThenKey="RecentFile"&(i+1)SaveSettingThisApp,ThisKey,Key,strFileEndIfNexti'將正在打開的文件寫到最近使用的文件列表的第一項SaveSettingThisApp,ThisKey,"RecentFile1",OpenFileNameEndSubFunctionFgi(rAsInteger,cAsInteger)AsInteger'表格單元值函數Fgi=c+frmMain.ActiveForm.ChengJB.Cols*rEndFunctionSubCopyThing(a,b,c,dAsInteger)'復制過程Dimi,jAsIntegerDimCopyTextAsStringCopyText=""WithfrmMain.ActiveFormFori=aTobForj=cTodCopyText=CopyText&.ChengJB.TextArray(Fgi((i),(j)))Ifj<>dThenCopyText=CopyText&vbTabEndIfNextjIfi<>bThenCopyText=CopyText&vbCrLfEndIfNextiClipboard.ClearClipboard.SetTextCopyTextEndWithEndSubSubFontChang(sAsString)'字體變化過程WithfrmMain.ActiveFormDimAbcAbc=.ChengJB.Font.Size+sIfAbc>0Then.ChengJB.Font.Size=AbcFori=2To17.ChengJB.ColWidth(i)=.ChengJB.ColWidth(1)*7/8Next.ChengJB.ColWidth(18)=.ChengJB.ColWidth(1)*5/8.txtedit.Font.Size=.ChengJB.Font.SizeFState(.Tag).Dirty=TruefrmMain.sbStatusBar.Panels(3).Text="當前表格字號"&.ChengJB.Font.SizeEndWithEndSubSubChushi()'初始化主窗體狀態欄WithfrmMain.ActiveFormIf.TextShuxing(1).Text<>"Text1"ThenfrmMain.sbStatusBar.Panels(1).Text=_"班級:"&.TextShuxing(1).Text&""&.TextShuxing(2).Text.ChengJB.ToolTipText=""ElsefrmMain.sbStatusBar.Panels(1).Text=_"未知班級請單擊“文件”菜單下的“屬性”項,設置屬性"EndIfEndWithEndSub程序運行主界面截圖:功能介紹:可進行日常的成績統計,添加、刪除、修改班級,科目、學生,還可按照科目和學號組合查詢、可按照班級打印成績單題目要求:(2)畫出信號波形。(3)對該信號采樣,并作文件存入磁盤中。(4)幅度、頻率兩種調制方式。設計方案:使用編程語言為:MicrosoftVisualBasic開發工具為:MicrosoftVisualBasic6.0sp6中文企業版本題編程語言仍選擇VB。信號的調制就是用一個頻率適當的余弦信號乘以原信號,得到想要的高頻信號。在輸入載波信號,調制信號的頻率和幅值后,選擇調制方式,然后根據所選的調制方式進行調制。本題首先打開與選擇波形相匹配的已存文件,然后設置調制波形的振幅頻率,根據設置的振幅頻率畫出圖形,在設置在波信號的振幅頻率,根據設置的振幅頻率畫出圖形,最后顯示抽樣波形,畫出圖形流程圖:開始開始選擇調制波形設定頻率與幅值,設定載波幅值與頻率定義坐標變量(y,t)t=0t<=T0輸出(y,t)t=t+0.001結束源代碼:Publica1,w1,a2,w2,m1,m2,n1,n2AsDouble,filenameAsStringPrivateSubCommand1_Click()'繪制波形Picture1.Clsa1=Val(Text1.Text):w1=Val(Text2.Text)'調制信號m1=HScroll1.Value:m2=HScroll2.ValueIf(a1>0Andw1>0)ThenIfOption1.ValueOrOption2.ValueOrOption3.ValueOrOption4.ValueThenCallSource(a1,w1)ElseMsgBox"請選擇調制波形",,"提示"ExitSubEndIfElseMsgBox"輸入不符合條件請重新輸入",,"提示"ExitSubEndIfEndSubPrivateSubCommand10_Click()Picture3.ClsCallfm(a1,w1,a2,w2)EndSubPublicSubfm(a1,w1,a2,w2)'已調波形Step=Picture3.Width/9255Picture3.Line(0,1150)-(Picture3.Width,1150)IfOption1.ValueThen'選擇余弦Forn=0ToPicture3.WidthStepStepX=nY=1150-a2*HScroll1.Value*Cos(Cos(w1*X*HScroll2.Value/100)*w2*X*HScroll4.Value/100)Picture3.PSet(X,Y)NextEndIfEndSubPrivateSubCommand11_Click()save_pictureCommonDialog1.ShowSaveEndSubPrivateSubsave_picture()CommonDialog1.Filter="BMP格式文件(*.bmp)|*.bmp"CommonDialog1.Flags=cdlOFNPathmustexitOrcdlOFNOverwritePromptCommonDialog1.ShowSaveIfCommonDialog1.filename=""ThenExitSubSavePicturePicture3.Image,CommonDialog1.filenameEndSubPrivateSubCommand12_Click()Picture3.ClsStep=Picture3.Width/92.55Picture3.Line(0,1150)-(Picture3.Width,1150)Forn=0ToPicture3.WidthStepStepX=nY=a2*HScroll1.Value*Cos(Cos(w1*X*HScroll2.Value/100)*w2*X*HScroll4.Value/100)Picture3.Line(X,1150)-(X,1150-Y)NextEndSubPrivateSubCommand3_Click()Picture2.ClsPicture2.Line(0,900)-(Picture2.Width,900)a2=Val(Text3.Text):w2=Val(Text4.Text)n1=HScroll3.Value:n2=HScroll4.ValueStep=Picture2.Width/9255Forn=0ToPicture2.WidthStepStepX=nY=900+n1*a2*Cos(w2*X*n2*0.01)Picture2.PSet(X,Y)NextEndSubPrivateSubCommand2_Click()Picture1.ClsEndSubPublicSubSource(a1,w1)'調制信號Picture1.Line(0,1000)-(Picture1.Width,1000)IfOption1.ValueThen'余弦Step=Picture1.Width/9255Forn=0ToPicture1.WidthStepStepX=nY=1000+m1*a1*Cos(w1*X*0.01*m2)Picture1.PSet(X,Y)NextElseIfOption2.ValueThenStep=6.283185307/(w1*m2*0.01)Forn=0ToPicture1.WidthStepStep'方波Picture1.Line(n,1000+m1*a1)-(n+Step/2,1000+m1*a1)Picture1.Line(n+Step/2,1000+m1*a1)-(n+Step/2,1000-m1*a1)Picture1.Line(n+Step/2,1000-m1*a1)-(n+Step,1000-m1*a1)Picture1.Line(n+Step,1000-m1*a1)-(n+Step,1000+m1*a1)NextElseIfOption3.ValueThenStep=6.283185307/(w1*m2*0.01)Forn=0ToPicture1.WidthStepStepPicture1.Line(n,1000+m1*a1)-(n+Step,1000-m1*a1)Picture1.Line(n+Step,1000-m1*a1)-(n+Step,1000+m1*a1)NextElseIfOption4.ValueThenStep=6.283185307/(w1*m2*0.01)Forn=0ToPicture1.WidthStepStepPicture1.Line(n,1000+m1*a1)-(n+Step/2,1000-m1*a1)Picture1.Line(n+Step/2,1000-m1*a1)-(n+Step,1000+m1*a1)NextEndIfEndSubPrivateSubCommand4_Click()Picture2.ClsEndSubPrivateSubCommand5_Click()Picture3.ClsCallmodulated(a1,w1,a2,w2)EndSubPublicSubmodulated(a1,w1,a2,w2)'已調波形Step=Picture3.Width/9255Picture3.Line(0,1150)-(Picture3.Width,1150)IfOption1.ValueThen'選擇余弦Forn=0ToPicture3.WidthStepStepX=nY=1150-a1*a2*HScroll1.Value/10*HScroll3.Value/10*Cos(w1*X*HScroll2.Value/100)*Cos(w2*X*HScroll4.Value/100)Picture3.PSet(X,Y)NextElseIfOption2.ValueThensp=3(w1*m2*0.01)s=1Forn=0ToPicture3.WidthStepsp'方波ForX=nTo(n+sp)StepStepY=1150-a1*s*a2*HScroll3.Value/10*HScroll1.Value/10*Cos(w2*X*HScroll4.Value/100)Picture3.PSet(X,Y)Nexts=s*(-1)NextElseIfOption3.ValueThen'鋸齒sp=6.283185307/(w1*m2*0.01)Forn=0ToPicture3.WidthStepspForz=(-sp/2)To(sp/2)StepStepX=n+z+sp/2Y=1150-2*a1*a2*z*HScroll1.Value/10*HScroll3.Value/10*Cos(w2*X*HScroll4.Value/100)/spPicture3.PSet(X,Y)NextNextElseIfOption4.ValueThen'三角波sp=6.283185307/(w1*m2*0.01)Forn=0ToPicture3.WidthStepspForz=(-sp/2)To(sp/2)StepStepX=n+z+sp/2Y=1150-2*a1*a2*z*HScroll1.Value/10*HScroll3.Value/10*Cos(w2*X*HScroll4.Value/100)/spPicture3.PSet(X,Y)NextNextEndIfEndSubPrivateSubCommand6_Click()Picture3.ClsPicture3.ClsStep=Picture3.Width/92.55Picture3.Line(0,1150)-(Picture3.Width,1150)Forn=0ToPicture3.WidthStepStepX=nY=a2*HScroll3.Value*Cos(w2*X*HScroll4.Value/100+Cos(w1*X*HScroll4.Value/100))Picture3.Line(X,1150)-(X,1150-Y)NextEndSubPrivateSubCommand7_Click()DimfilenoAsIntegerDimresponseStep=Picture3.Width/92.55fileno=FreeFileOnErrorResumeNext'設置錯誤處理否則if不能用CommonDialog1.CancelError=True'設置錯誤處理否則if不能用CommonDialog1.Action=2'打開共用對話框CommonDialog1.Filter="Word文檔(*.DOC)|*.DOC|文本文件(*.TXT)|*.TXT|所有文件(*.*)|*.*"'設置過濾但沒法用CommonDialog1.FilterIndex=2'設置過濾默認值但沒法用IfErr.Number=32755Then'選擇取消時ExitSubEndIffilename=CommonDialog1.filenameOpenCommonDialog1.filenameForOutputAs#filenoPrint#fileno,"x","y";IfOption1.ValueThen'選擇余弦Forn=0ToPicture3.WidthStepStepX=nY=a1*a2*HScroll1.Value/10*HScroll3.Value/10*Cos(w1*X*HScroll2.Value/100)*Cos(w2*HScroll4.Value/100*X)Print#fileno,X,YNextElseIfOption2.ValueThensp=3(w1*m2*0.01)s=1Forn=0ToPicture3.WidthStepsp'方波ForX=nTo(n+sp)StepStepY=a1*s*a2*HScroll1.Value/10*HScroll3.Value/10*Cos(w2*HScroll4.Value/100*X)Print#fileno,X,YNexts=s*(-1)NextElseIfOption3.ValueThen'鋸齒sp=6.283185307/(w1*m2*0.01)Forn=0ToPicture3.WidthStepspForz=(-sp/2)To(sp/2)StepStepX=n+z+sp/2Y=2*a1*z*a2*HScroll1.Value/10*HScroll3.Value/10*Cos(w2*HScroll4.Value/100*X)/spPrint#fileno,X,YNextNextElseIfOption4.ValueThen'sp=6.283185307/(w1*m2*0.01)Forn=0ToPicture3.WidthStepspForz=(-sp/2)To(sp/2)StepStepX=n+z+sp/2Y=2*a1*a2*z*HScroll1.Value/10*HScroll3.Value/10*Cos(w2*X*HScroll4.Value/100)/spPrint#fileno,X,YNextNextEndIfCloseEndSubPrivateSubCommand8_Click()Step=Picture3.Width/92.55Picture3.ClsIfOption1.ValueThen'選擇余弦Forn=0ToPicture3.WidthStepStepX=nY=a1*a2*HScroll1.Value/10*HScroll3.Value/10*Cos(w1*X*HScroll2.Value/100)*Cos(w2*HScroll4.Value/100*X)Picture3.Line(X,1150)-(X,1150-Y)NextElseIfOption2.ValueThensp=3(w1*HScroll2.Value/100)s=1Forn=0ToPicture3.WidthStepsp'方波ForX=nTo(n+sp)StepStepY=a1*s*a2*HScroll1.Value/10*HScroll3.Value/10*Cos(w2*HScroll4.Value/100*X)Picture3.Line(X

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論