




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
暑期實(shí)習(xí)報(bào)告由數(shù)字信號處理原理可知:計(jì)算有限長數(shù)字序列線性卷積的公式為:則題目要求:(1)輸入N1,N2,輸出y(n)值(2)在圖形方式下以x軸為n,y軸分別為x(n)、h(n)、y(n)畫出其關(guān)系圖設(shè)計(jì)方案:使用編程語言為:MicrosoftVisualBasic開發(fā)工具為:MicrosoftVisualBasic6.0sp6中文企業(yè)版在Form1中進(jìn)程編輯,利用五個CommandButton,分別控制x(n)、h(n)、y(n)的序列圖像輸出、y(n)序列輸出及清除功能,3個Picturebox用來顯示x(n)、h(n)、y(n)的坐標(biāo)圖,Label用來表達(dá)所要操作的內(nèi)容。定義兩個整型變量N1、N2,要想顯示其中的一個圖像時,先將所輸入的兩個值附給上述兩個變量,然后利用Picture.Scale與Picture.Line來畫坐標(biāo)圖,最后通過for….next語句實(shí)現(xiàn)循環(huán)畫點(diǎn),從而實(shí)現(xiàn)每個圖像的顯示。當(dāng)想進(jìn)行清除時只要再清除的CommandButton下輸入Picture.Cls、Label.Caption=""、Text.Text=""等語句即可。流程圖:開始開始定義變量N1,N2輸入兩個整形數(shù)分別賦值給N1,N2N1<=N2輸出x(n),h(n),y(n)的圖形按N1>N2的情況輸出y(n)輸出x(n),h(n),y(n)的圖形按N1<=N2的情況輸出y(n)結(jié)束源代碼:DimN1%,N2%PrivateSubCommand1_Click()N1=Int(Text1.Text):N2=Int(Text2.Text)Picture1.Scale(-1,20)-(20,-1)'畫x(n)坐標(biāo)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)坐標(biāo)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程序運(yùn)行主界面截圖:功能介紹:當(dāng)輸入N1,N2的值后,點(diǎn)擊X(n)序列圖,坐標(biāo)圖中將顯示X(n)的坐標(biāo)圖,點(diǎn)擊H(n)序列圖坐標(biāo)圖中將顯示H(n)的坐標(biāo)圖,點(diǎn)擊Y(n)序列圖將坐標(biāo)圖中顯示Y(n)的序列圖并輸出Y(n)的值。清除可以清除掉當(dāng)前輸入的N1,N2的值,保存具有保存當(dāng)然坐標(biāo)圖象的功能。題目要求:設(shè)計(jì)方案:使用編程語言為:MicrosoftVisualBasic開發(fā)工具為:MicrosoftVisualBasic6.0sp6中文企業(yè)版當(dāng)輸入所要查詢的日期所在的年和月是否是閏年和閏月時,應(yīng)先對其進(jìn)行計(jì)算并判斷,然后分別顯示年和月是否為閏的情況并同時顯示輸入日期是星期幾。當(dāng)輸入設(shè)置時間time1后,每當(dāng)系統(tǒng)時間的增加1秒就和所設(shè)的時間比較一遍,直到相等時則開始執(zhí)行所需任務(wù),彈出對話框并進(jìn)行聲音提醒,當(dāng)點(diǎn)擊確認(rèn)之后之后則整個提醒結(jié)束,并可以重新設(shè)置下個提醒任務(wù)。流程圖:開始開始定義變量year,month,day輸入三個整型數(shù)分別賦值給以上三個變量所賦的時間合理顯示所輸入日期所在的閏年、閏月的情況及是星期幾定義變量timeds1.text,time2.text輸入所設(shè)的時間并賦值給timeds1.text將系統(tǒng)的當(dāng)前時間值賦給time2.texttimeds1.text=time2,text彈出提示框并運(yùn)行聲音文件確認(rèn)結(jié)束源代碼:PrivateSubnl1_Click()'設(shè)定鬧鈴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,"退出系統(tǒng)")Ifx=6Then'點(diǎn)擊“是”,退出EndEndIfEndSubPrivateSubText2_Change()IfTextds1.Text=Text2.TextThen'當(dāng)設(shè)定的時間與當(dāng)時時間一樣時MMControl1.Command="open"'鬧鈴打開并播放MMControl1.Command="play"a=MsgBox(Textdingshi1.Text,0,"事件")'彈出對話框顯示事件提醒MMControl1.Command="stop"'點(diǎn)擊確定后鬧鈴關(guān)閉,同時設(shè)定的時間與事件一并清除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()'捕捉文本框內(nèi)容的改變,立刻顯示是否閏年IfText3.Text=""ThenText4.Text="未輸入年份"Elsea=Val(Text3.Text)IfaMod100=0Then'當(dāng)a被100整除時判斷是否也被400整除IfaMod400=0ThenText4.Text="是"'是則是閏年ElseText4.Text="否"'否則不是閏年EndIfElseIfaMod4=0Then'當(dāng)a不被100整除時判斷是否被4整除Text4.Text="是"'是則是閏年ElseText4.Text="否"'否則不是閏年EndIfEndIfEndIfEndSubPrivateSubTimer1_Timer()Text1.Text=Date$'輸出日期Text2.Text=Format(Time,"ttttt")'輸出時間EndSub程序運(yùn)行主界面截圖:功能介紹:可輸入的要查詢的年份是否為閏年并且題目要求:作一個兩輛賽車比賽的游戲,要求可以用A,S,D,W和小鍵盤的上下左右鍵控制小汽車的運(yùn)行方向進(jìn)行比賽。設(shè)計(jì)方案:所用軟件為MacromediaFlash8設(shè)置控制鍵,通過按鍵對小車進(jìn)行控制,在控制的同時判斷小車的位置使其行駛在跑道上,當(dāng)而這種有一個到達(dá)終點(diǎn)時,比賽結(jié)束,并輸出比賽結(jié)果。開始流程圖:開始方向鍵控制方向鍵控制小車停止小車停止對兩小車是否碰到跑道進(jìn)行判斷對兩小車是否碰到跑道進(jìn)行判斷YYNN判斷比賽是否完成判斷比賽是否完成NNYY顯示比賽的輸贏顯示比賽的輸贏結(jié)束結(jié)束源代碼: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;}; }}程序運(yùn)行主界面截圖:功能介紹:可進(jìn)行兩輛賽車的比賽4、題目要求:設(shè)計(jì)一個成績管理系統(tǒng),可添加、刪除、修改班級,科目、學(xué)生。可按照科目和學(xué)號組合查詢、可按照班級打印成績單(要求:可添加、刪除、修改班級,科目、學(xué)生,查詢、打印)設(shè)計(jì)方案:使用編程語言為:MicrosoftVisualBasic開發(fā)工具為:MicrosoftVisualBasic6.0sp6中文企業(yè)版對輸入的數(shù)據(jù)庫文件進(jìn)行存儲,然后對其訪問即可開始流程圖:開始建立數(shù)據(jù)庫文件建立數(shù)據(jù)庫文件保存保存對選定的班級進(jìn)行成績打印按科目和學(xué)號查找對數(shù)據(jù)庫文件進(jìn)行修改操作對選定的班級進(jìn)行成績打印按科目和學(xué)號查找對數(shù)據(jù)庫文件進(jìn)行修改操作結(jié)束結(jié)束源代碼:窗體代碼:frmMainPrivateSubMDIForm_Load()Me.Width=Screen.Width*0.75Me.Height=Screen.Height*0.75Me.Left=Screen.Width*0.125Me.Top=Screen.Height*0.125Me.Show'總是將工作目錄設(shè)到應(yīng)用程序所在目錄ChDirApp.Path'初始化文檔窗體數(shù)組,并顯示第一個子窗體ReDimDoc(1)ReDimFState(1)Doc(1).Tag=1FState(1).Dirty=FalseDoc(1).Caption="新成績表:1"Doc(1).Show'讀系統(tǒng)注冊表并適當(dāng)?shù)卦O(shè)置最近使用的菜單文件列表控件數(shù)組GetRecentFilesEndSubPrivateSubMDIForm_Unload(CancelAsInteger)IfNotAnyPadsLeft()ThenEndEndIfEndSubPrivateSubmnuFileExit_Click()EndEndSubPrivateSubmnuFileNew_Click()'調(diào)用FileNew過程FileNewEndSubPrivateSubmnuFileOpen_Click()'調(diào)用文件打開過程FileOpenProcEndSubPrivateSubmnuHelpAbout_Click()frmAbout.ShowvbModal,MeEndSubPrivateSubmnuhelpmain_Click()frmHelp.ShowvbModal,MeEndSubPrivateSubmnuRecentFile_click(IndexAsInteger)'調(diào)用文件打開過程,傳遞一個對選定文件名的引用OpenFile(mnuRecentFile(Index).Caption)'更新文件列表GetRecentFilesEndSubPrivateSubtbToolBar_ButtonClick(ByValButtonAsComctlLib.Button)'用SelectCase語句處理Key屬性,'以確定單擊了哪個按鈕。WithfrmMain.ActiveFormSelectCaseButton.KeyCase"new"'選擇新建FileNewCase"Open"'選擇打開FileOpenProcCase"Save"'選擇保存'檢測文件是否已經(jīng)有了文件名DimstrFilenameAsStringIfLeft(frmMain.ActiveForm.Caption,4)="新成績表"ThenstrFilename=GetFileName(strFilename)ElsestrFilename=.CaptionEndIfIfstrFilename<>""ThenSaveFileAsstrFilename'調(diào)用文件保存過程EndIfCase"Print"'選擇打印filePrintJCase"Copy"'選擇復(fù)制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'用戶自定義數(shù)組PublicDoc()AsNewfrmBG'子窗體對象數(shù)組PublicConstThisApp="管理系統(tǒng)"'定義ThisApp函數(shù)PublicConstThisKey="RecentFiles"'定義ThisKey函數(shù)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'如果子窗體對象數(shù)組中沒有一個元素被刪除,'文檔數(shù)組與狀態(tài)數(shù)組均加1并返回新元素的索引(Index)。ReDimPreserveDoc(ArrayCount+1)ReDimPreserveFState(ArrayCount+1)FindFreeIndex=UBound(Doc)EndFunctionSubGetRecentFiles()'讀注冊表數(shù)據(jù),更新“文件”菜單Dimi,jAsIntegerDimVarFilesAsVariant'用Getallsettings語句從注冊表中返回最近使用過的文件'常數(shù)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)'寫注冊表數(shù)據(jù)'本過程使用SaveSettings語句將最近使用的文件名寫入系統(tǒng)注冊表Dimi,jAsIntegerDimstrFile,KeyAsString'將文件RecentFile1復(fù)制給RecentFile2等等Fori=3To1Step-1Key="RecentFile"&istrFile=GetSetting(ThisApp,ThisKey,Key)IfstrFile<>""ThenKey="RecentFile"&(i+1)SaveSettingThisApp,ThisKey,Key,strFileEndIfNexti'將正在打開的文件寫到最近使用的文件列表的第一項(xiàng)SaveSettingThisApp,ThisKey,"RecentFile1",OpenFileNameEndSubFunctionFgi(rAsInteger,cAsInteger)AsInteger'表格單元值函數(shù)Fgi=c+frmMain.ActiveForm.ChengJB.Cols*rEndFunctionSubCopyThing(a,b,c,dAsInteger)'復(fù)制過程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="當(dāng)前表格字號"&.ChengJB.Font.SizeEndWithEndSubSubChushi()'初始化主窗體狀態(tài)欄WithfrmMain.ActiveFormIf.TextShuxing(1).Text<>"Text1"ThenfrmMain.sbStatusBar.Panels(1).Text=_"班級:"&.TextShuxing(1).Text&""&.TextShuxing(2).Text.ChengJB.ToolTipText=""ElsefrmMain.sbStatusBar.Panels(1).Text=_"未知班級請單擊“文件”菜單下的“屬性”項(xiàng),設(shè)置屬性"EndIfEndWithEndSub程序運(yùn)行主界面截圖:功能介紹:可進(jìn)行日常的成績統(tǒng)計(jì),添加、刪除、修改班級,科目、學(xué)生,還可按照科目和學(xué)號組合查詢、可按照班級打印成績單題目要求:(2)畫出信號波形。(3)對該信號采樣,并作文件存入磁盤中。(4)幅度、頻率兩種調(diào)制方式。設(shè)計(jì)方案:使用編程語言為:MicrosoftVisualBasic開發(fā)工具為:MicrosoftVisualBasic6.0sp6中文企業(yè)版本題編程語言仍選擇VB。信號的調(diào)制就是用一個頻率適當(dāng)?shù)挠嘞倚盘柍艘栽盘枺玫较胍母哳l信號。在輸入載波信號,調(diào)制信號的頻率和幅值后,選擇調(diào)制方式,然后根據(jù)所選的調(diào)制方式進(jìn)行調(diào)制。本題首先打開與選擇波形相匹配的已存文件,然后設(shè)置調(diào)制波形的振幅頻率,根據(jù)設(shè)置的振幅頻率畫出圖形,在設(shè)置在波信號的振幅頻率,根據(jù)設(shè)置的振幅頻率畫出圖形,最后顯示抽樣波形,畫出圖形流程圖:開始開始選擇調(diào)制波形設(shè)定頻率與幅值,設(shè)定載波幅值與頻率定義坐標(biāo)變量(y,t)t=0t<=T0輸出(y,t)t=t+0.001結(jié)束源代碼:Publica1,w1,a2,w2,m1,m2,n1,n2AsDouble,filenameAsStringPrivateSubCommand1_Click()'繪制波形Picture1.Clsa1=Val(Text1.Text):w1=Val(Text2.Text)'調(diào)制信號m1=HScroll1.Value:m2=HScroll2.ValueIf(a1>0Andw1>0)ThenIfOption1.ValueOrOption2.ValueOrOption3.ValueOrOption4.ValueThenCallSource(a1,w1)ElseMsgBox"請選擇調(diào)制波形",,"提示"ExitSubEndIfElseMsgBox"輸入不符合條件請重新輸入",,"提示"ExitSubEndIfEndSubPrivateSubCommand10_Click()Picture3.ClsCallfm(a1,w1,a2,w2)EndSubPublicSubfm(a1,w1,a2,w2)'已調(diào)波形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)'調(diào)制信號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)'已調(diào)波形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'設(shè)置錯誤處理否則if不能用CommonDialog1.CancelError=True'設(shè)置錯誤處理否則if不能用CommonDialog1.Action=2'打開共用對話框CommonDialog1.Filter="Word文檔(*.DOC)|*.DOC|文本文件(*.TXT)|*.TXT|所有文件(*.*)|*.*"'設(shè)置過濾但沒法用CommonDialog1.FilterIndex=2'設(shè)置過濾默認(rèn)值但沒法用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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 漢臺區(qū)游樂設(shè)施管理辦法
- 防腐保溫工程管理辦法
- 金融消費(fèi)權(quán)益管理辦法
- 孝昌縣人防車位管理辦法
- 臨時機(jī)械及用工管理辦法
- 銷售人員管理辦法定義
- 銀行費(fèi)用管理辦法試行
- 銀行資產(chǎn)收集管理辦法
- 集中公寓運(yùn)營管理辦法
- 防疫應(yīng)急值班管理辦法
- 裝配式結(jié)構(gòu)吊裝施工計(jì)算書
- 中考語文專題復(fù)習(xí):傳統(tǒng)文化常識100題-專項(xiàng)練習(xí)題(含答案)
- 《交替?zhèn)髯g1》課程教學(xué)大綱
- 梁平舊亂賬清理設(shè)計(jì)方案
- 絲蟲病藥物研發(fā)研究
- 雙減背景下課后服務(wù)心得
- 工傷認(rèn)定申請表(范表)
- 2023護(hù)理分級標(biāo)準(zhǔn)(代替WS-T431-2013)
- 242個國家中英文名稱對照
- 多聯(lián)機(jī)技術(shù)與產(chǎn)品介紹-課件
- 易制毒化學(xué)品進(jìn)貨采購管理制度
評論
0/150
提交評論