版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、數(shù)字信號處理實驗報告一、 實驗?zāi)康?. 深入掌握應(yīng)用dft分析信號的頻譜的理論方法,針對該問題進(jìn)行一次全面綜合 練習(xí),完成一個完整的信號分析軟件實現(xiàn)方法和流程,這種全面完整的綜合練 習(xí)可以幫助學(xué)生深入理解和消化基本理論,鍛煉學(xué)生獨立解決問題的能力,培 養(yǎng)學(xué)生的創(chuàng)新意識,為今后的科研和工作打下良好的實踐基礎(chǔ)。2. 綜合利用數(shù)字信號處理的理論知識完成數(shù)字濾波器的設(shè)計與實現(xiàn),完成一個完 整的數(shù)字濾波器設(shè)計軟件的實現(xiàn)方法和流程。這種全面完整的綜合練習(xí)可以幫 助學(xué)生深入理解和消化基本理論,鍛煉學(xué)生獨立解決問題的能力,培養(yǎng)學(xué)生的 創(chuàng)新意識,為今后的科研和工作打下良好的實踐基礎(chǔ)。實驗設(shè)備與環(huán)境計算機(jī)、mat
2、lab軟件環(huán)境三、實驗內(nèi)容1. 基于matlab gui的離散傅里葉變換分析2. 基于matlab gui的數(shù)字濾波器分析設(shè)計四、實驗結(jié)果1.基于matlab gui的離散傅里葉變換分析信號:t=l:100; x=2*sin(t/25*2*pi)+5*sin(t/5*2*pi);說明:輸入信號從matlab command windows中生成,通過變量名導(dǎo)入本軟件,并 可輸岀dft變換后的結(jié)果,默認(rèn)名為dft輸入變量名。2.基于matlab gui的數(shù)字濾波器分析設(shè)計 hr低通:(巴特沃茲)choose the type« ir © firtype lowpassdigi
3、tal filter builder1 4( orqp04qs06°002020811-300400-5008p_(g工一8 6 o o -31-20060070020020406081dutterworthgeneraters20rp23(gh jo1510203010(yu yizhe)hr咼通:(切比雪夫i)iir帶通:(切比雪夫ii)digital filter builderchoose tm type。hr c firtype: bandpassparameterupper0708tt0020406 0 810.302lcwerttrp rs220 dbgeneratea
4、suodsay 3s-nduj-1002040608w)i0>102030ncopynqht (yu yizhe)iir帶阻:(橢圓濾波器)fl fitterchoote the typedigital filter builder1 4i or12-50o ir c firtype: bandstop100parameter1_?_500.80.7020.3upperlowerttttrp rs220 db匚 lliptic3khh jo s£asuodse qs-nduj-08 11102030fir低通:(矩形窗)digital filter builderchoose
5、the type1 4 | orhrtypei lowpasso firparameterqp qs0406rp rs220 db0_ar_3(gh1o.2o-3o-40-5o&.7o8p_anh一o o o usuodsehos-nduj-0 14)2100 206rectangularfir高通:(漢寧窗)o filterdigital filter builder_ choomtmt/peoir « firtype:highpassqp qs0604tthrrp rs240dbhanningfarametersuodsew«>s-nduj-8p_(an
6、工 _皿-80血120o20040102030402 ocopyright (yu yizhefir帶通:(布萊克曼窗)digital filter builderchoose the typeir < firtype: bandpasskg工一50血8p_ad 工一fir帶阻:(凱瑟窗)digital filter builder一 choose tm type080.7upperir firtype bandstop0203v-033i jo 2w5o esuodseh tnde-owocpoo 百 o 24©c91o<12(14 *°20501001502
7、00250copyright (yu yizhe五、程序界面設(shè)計及程序源代碼1.基于matlab gui的離散傅里葉變換分析 界面設(shè)計:程序代碼:function varargout =sign aldftsoftware(varargin)% signaldftsoftware matlab code forsign aldftsoftware.fig% signaldftsoftware, by itself, creates a new signaldftsoftware or raises the existing%singleton*.% h = signaldftsoftware
8、returns the handle to a new signaldftsoftware or the handle to%the existing singleton*.%signaldftsoftwarefcallbackhobjecteven tdata,handles,)calls the local%function named callback insignaldftsoftware.m with the given input argume nts.%signaldftsoftwarecproperty'/value',.) creates a new sign
9、aldftsoftware or raises the%existing singleton*. starting from theleft, property value pairs are% applied to the gui beforesign a id ftsoftware_o pe nin gfc n gets called.an%unrecognized property name or invalidvalue makes property application% stop all inputs are passed tosign a id ftsoftware_o pe
10、nin gfc n via varargi n. % *see gui options on guide's tools menu choose hgui allows only one%instanee to run (singleton)".% see also: guide, gui data, guihandles% edit the above text to modify the response to help signaldftsoftware% last mod訐ied by guide v2.5 26-nov-2011 12:55:11% begin in
11、itialization code - do not edit gui_si nglet on = 1;gui_state = structfgulname1,mfilename,*gui_singlet on:gui_singleton,'gui_openingfc n: signaldftsoftware_openingfcn,*gui_outputfc n: signaldftsoftware_outputfcn,uilayoutfcn: z. 'gui_callback'z );if nargin && ischar(vararginl)gui_
12、state.gulcallback =str2f un c(vararginl);end訐 n argoutvarargoutl:nargout= gui_mainfcn(gui_state, varargin:); elsegui_mainfcn(gui_state, varargin:);end% end initialization code - do not edit% 一- executes just before signaldftsoftware is made visible.functionsign a id ftsoft wa re_o pe nin gfc n(hobje
13、ct, eve ntdata, han dies, varargi n) % this function has no output args, see outputfcn.% hobject handle to figure% eventdata reserved to be defined in a future version of matlab% varargin comma nd line argume nts to signaldftsoftware (see varargin)% choose default comma nd line output forsignaldftso
14、ftwarehan dies.output = hobject;% update han dies structure guidatafhobject, han dies);% uiwait makes signaldftsoftware wait for user response (see uiresume)% uiwaitfhandles.figurel);% outputs from this function are returned to the comma nd line.function varargout =signaldftsoftware_outputfcn(hobjec
15、t,eve ntdata, han dies)% varargout cell array for returning output args (see varargout);% hobject handle to figure% eventdata reserved - to be defined in a future version of matlab% get default comma nd line output from han dies structure varargoutl = han dies.output;% if enable = 'on: executes
16、on mouse press in 5 pixel border.% otherwise, executes on mouse press in 5 pixel border or over random.function random_buttondownfcn(hobject, eve ntdata, han dies)% hobject handle to random (see gcbo)% eventdata reserved - to be defined in a future version of matlab% executes on butt on press in ran
17、 dom function random_callback(hobject, eventdata, han dies)% hobject handle to random (see gcbo) % eventdata reserved - to be defined in a future version of matlabglobal x;global x_flag;x=rand(l,50)*20-10;x_flag=l;if(x_flag)plot(handles.td,0:(length(x)-l),x);end% executes on butt on press in delete
18、function delete_callback(hobject, eventdata, han dies)% hobject handle to delete (see gcbo)% eventdata reserved - to be defined in a future version of matlabglobal x;global x;global x_flag;global x_flag;x=0;x=o;x_flag=0;x_flag=0;plot(handles.td,0,0);plot(handles.fd,0,0);%if enable = 'on: execute
19、s on mouse pressin 5 pixel border.% otherwise, executes on mouse press in 5 pixel border or over delete.fun ctio n delete_butt on dow nfcn(hobject, eventdata, han dies)% hobject handle to delete (see gcbo)% eventdata reserved to be defined in a future version of matlab%if enable = 'on: executes
20、on mouse pressin 5 pixel border.% otherwise, executes on mouse press in 5 pixel border or over analysefun ctio n an alyse_butt on dow nf cn(hobject, eventdata, han dies)% hobjecthandle to analyse (see gcbo)% eventdata reserved to be defined in a future version of matlab% executes on butt on press in
21、 analyse function analyse_callback(hobject, eventdata, han dies)% hobject handle to analyse (see gcbo)% eventdata reserved - to be defined in a future version of matlabglobal x;global x;global x_flag;global x_flag;if(x_flag)x=fft(x);x_flag=l;endif(x_flag)stem(handles.fdjinspace(0,2*pi,length(x)/abs(
22、 x);xlim(handles.fd,0,2*pi)end% executes on butt on press in export function export_callback(hobject, eventdata, han dies)% hobject handle to export (see gcbo)% eventdata reserved to be defined in a future version of matlabglobal x;global x_flag;if(x_flag)assigni n('base:get(ha ndles.edit4,strin
23、g)x); end% executes during object creation, after setting all properties.function textl_createfcn(hobject, eventdata, han dies)% hobject handle to textl (see gcbo)% eventdata reserved to be defined in a future version of matlab% han diesempty han dies not created untilafter all createfcns calledglob
24、al x_flag;global x_flag;global x;global x;x_flag=0;x_flag=0;x=0;x=o;function name_callback(hobject, eventdata, han dies)% hobject handle to name (see gcbo)% eventdata reserved to be defined in a future version of matlab% hin ts: get(hobject/stri ng1) retur ns con tents of name as text%str2double(get
25、(hobject,'string')returns contents of name as a double% executes during object creation, after setting all propertiesfunction name_createfcn(hobject, eventdata, han dies)if ispc && isequalfgetfhobject/backgroundcolor1),get(0/defaultuicontrolbackgroundcolor') setfhobject/backgroun
26、dcolor'/white');end% -一 executes on butt on press in import, function import_callback(hobject, eventdata, han dies)global x;global x_flag;global signalame;signal_n ame=get(ha /string); x='empty,;set(,stringjnot exist,retry!f); x=evali n('base:sig nal_n ame);setf
27、ha ndles. name,sti ngtsucceect);x_flag=l;if(xlag)plot(handles.td,0:(length(x)-l),x);endsetfha ndles.edit4,stri ng:sttcat('dft:sig nal_na me);function edit4_callback(hobject, eventdata, han dies)function edit4_createfcn(hobject, eventdata,han dies)訐 ispc &&isequal(get(hobject,'backgro
28、 un dcolor*), getfo/defaultllicontrolbackgroundcolor')set(hobject/backgroundcolor,/white,);endglobal signalame;2.基于matlab gui的數(shù)字濾波器分析設(shè)計 界面設(shè)計:程序設(shè)計:function varargout = filterfvarargin)%edit by yu yizhe%v1.0%2011/ll/20%all right reserve% begin initialization code - do not editgui_singleton 二 1;gui
29、_state = struct(,gui_name,mfilename,.'gui_si ngleton;gui_singleton,.'guijdpe nin gfc n:filter_openingfcn,"gui_outputfc n:filter_outputfcn,.ullayoutfcn;,.'gui_callback'z );if nargin && ischar(vararginl)guistate.gulcallback = str2f un cfvarargi n ); end if n argoutvarargou
30、tl: nargout= gui_mainfcn(gui_state, varargin:);elsegui_mainfcn(gui_state” varargin:);end% end initialization code - do not edit% 一 executes just before filter is made visible, function filter_openingfcn(hobject, eventdata, han dies, varargi n)% this function has no output args, see outputfcn.% hobje
31、ct handle to figure% eventdata reserved - to be defined in a future version of matlab% varargi nun recog nizedpropertyname/propertyvalue pairs from the%command line (see varargin)% choose default commandl line output for filter han dies.output = hobject;% update handles structureguidatafhobject, han
32、 dies);% uiwait makes filter wait for user response (see uiresume)% uiwait(handles.figurel);% outputs from this function are returned to the comma nd line.function varargout = filter_outputfcn(hobject eventdata, han dies)% varargout cell array for returning output args (see varargout);% hobject hand
33、le to figure% eventdata reserved to be defined in a future version of matlab% get default comma nd line output from han dies structurevarargoutl = han dies.output;function textl_createfcn(hobject, eventdata,han dies)global chi;global ch2;global ch31;global ch32;chl=l;ch2=l;ch31=l;ch32=l;function iir
34、type_callback(hobject, eventdata,han dies)global chi;global ch2;global ch31;global ch32;ch31=get(hobject,'value');function iirtype_createfcn(hobject, eventdata, han dies)訐 ispc && isequal(get(hobject/backgroundcolor1),get(0/defaultuicontrolbackgroundcolor')set(hobject/backgroundc
35、olor','white');endfunction ell_createfcn(hobject, eventdata, han dies)訐 ispc && isequahgetlhobject/backgroundcolor1), getfo/defaultuicontrolbackgroundcolor1)setlhobject/backgroundcolorywhite1);endfunction el2_callback(hobject/ eventdata, han dies)function el2_createfcn(hobject, e
36、ventdata, han dies)訐 ispc && isequalfgetfhobject/backgroundcolor1), get(0/defaultllicontrolbackgroundcolor,)setfhobject/backgroundcolorvwhite1);endfunction e21_callback(hobject/ eventdata, han dies)function e21_createfcn(hobject, eventdata, han dies)if ispc && isequahgetfhobject/back
37、groundcolor1), getfojdefaultuicontrolbackgroundcolor')set(hobject/backgroundcolor7white');endfunction e22_callback(hobject, eventdata, han dies)function e22_createfcn(hobject, eventdata, han dies)if ispc && isequal(get(hobject/backgroundcolor1), getfo/defaultuicontrolbackgroundcolor&
38、#39;)set(hobject/backgroundcolor,/white,);endfunction e31_callback(hobject, eventdata, han dies)function e31_createfcn(hobject, eventdata, han dies)if ispc && isequal(get(hobject/backgroundcolof),getfo/defaultuicontrolbackgroundcolor1) setlhobject/backgroundcolorywhite1); endfunction e32_cal
39、lback(hobject/ eventdata,han dies)function e32_createfcn(hobject, eventdata, han dies)if ispc && isequal(get(hobject,'backgroundcolo門, get(o,'defaultuic on trolbackgro un dcolor1)setfhobject/backgroundcolor'/white');endfunction e41_callback(hobject, eventdata, han dies)functi
40、on e41_createfcn(hobject, eventdata, han dies)訐 ispc && isequal(get(hobject/backgroundcolor1),get(0/defaultuicontrolbackgroundcolor')set(hobject/backgroundcolor','white'); endfunction e42_callback(hobject, eventdata, han dies)function e42_createfcn(hobject, eventdata, han die
41、s)if ispc && isequal(get(hobject/backgroundcolor1),get(0/defaultuicontrolbackgroundcolor') setfhobject/backgroundcolor'/white');endfunction generate_callback(hobject, eventdata, han dies)global chi;global ch2;global ch31;global ch32;global typech;global wlp;global wls;global w2p;
42、global w2s;global rp;global rs;if chl=ltypech=chl*100+ch2*10+ch31;elseif ch2=2typech=chl*100+ch2*10+ch32;endwlp=str2num(get(handles.ell/string1);wls=str2 num(get(ha ndles.el2,stri ng); w2p=str2 num(get(handles.e21,string'); w2s=str2 nu m(get(ha ndles.e22/string,); rp=str2 nu m(get(ha ndles.e41/s
43、tring,); rs=str2 nu m(get(ha ndles.e42,stri ng'); gene rate(ha ndles);function firtype_callback(hobject, eventdata, han dies)global chi;global ch2;global ch31;global ch32;ch32=get(hobject/value');function firtype_createfcn(hobject, eventdata, han dies)if ispc && isequahgetfhobject/ba
44、ckgroundcolor1), getfojdefaultuicontrolbackgroundcolor') set(hobject/backgroundcolor7white');endfunction poptype_callback(hobject, eventdata, han dies)global chi;global ch2;global ch31;global ch32;ch2=get(hobjectz'value');reprint(ha ndles);function poptype_createfcn(hobject, eventdat
45、a, han dies)訐 ispc && isequalfgetfhobject/backgroundcolor1), get(0/defaultllicontrolbackgroundcolor,) setfhobject/backgroundcolorvwhite1);endfunction firchoose_callback(hobject, eventdata, han dies)global chi;global ch2;global ch31;global ch32;if(get(ha ndles.firchoose,value")=0)set(ha
46、ndles.iirchoose,value"); setfhandles.firtype/visible'/off'); setfhandles.lirtype/visible'/on'); chl=l;endif(get(ha ndles.firchoose,'value')=l) setfhandles.iirchoose/valueo); setfhandles.firtype/visible'/on'); setfhandles.lirtype/visible'/off');chl=2;endre
47、pri nt(ha ndles);functio n firchoose_butt on dow nfcn (hobject,eve ntdata, han dies)function iirchoose_callback(hobject, eventdata, han dies)global chi;global ch2;global ch31;global ch32;訐(get(ha ndles.iirchoos 巳'value')二=0)set(ha ndlesfirchoose,value;:l); setfhandles.firtype/visible'/on
48、'); setfhandles.lirtype/visible'/off');chl=2;endif(get(ha ndles.iirchoose/value')二二 1)set(ha ndles.firchoose,value;0);setfhandles.firtype/visible'/off'); setfhandles.lirtype/visible'/on'); chl=l;endrepri nt(handles);global chi;global ch2;global ch31;global ch32;temp=c
49、hl*10+ch2;tempswitch temp case 11,12setfhandles.addl/visible'/off'); set(handles.add 乙'visible'/off); set(handles.e21/visible7off); set(handles.e22/visible7off); setfhandles.pr/visible'/on');case13,14setfhandles.addl/visible'/on');set(handles.add2,visible'/on'
50、); set(handles.e21/visible'z'on'); set(handles.e22/visible7on'); set(ha ndles.pr,'visible','on');case21,22,setfhandles.addl/visible'/off); set(handles.add2/visible7off'); set(handles.e21/visible'z'off'); set(handles.e22/visible7off');case23,24,
51、setfhandles.addl/visible'/on1);set(handles.add2/visible7on');set(handles.e21/visible7on'); set(handles.e22/visible7on');otherwisefprintf/switch errorxn1);endfunction generate(handles) global chi;global ch2;global ch31;global ch32;global typech;global wlp;global wls;global w2p;global
52、w2s;global rp;global rs;n=0;wn=0;wp=0;wst=0;rp=0;as=0;ftype=,a,;b=0;a=0;switch ch2case 1, ftype='low'case 2, ftype='high'case 3, ftype='ba ndpass'case 4, ftype=,stopl;endswitch ch2case 1,2wp=wlp;wst=wls;rp=rp;as=rs;case 3,4wp=w2p wlp;wst=w2s wls;rp=rp;as=rs;endswitch chi%iirc
53、ase 1,switch ch31case 1,case 2,n/wn=cheblord(wp,wst,rpzas); b,a=chebyl(n,rp,w njtype);case 3,n/wn=cheb2ord(wp,wst,rpzas);b,a=cheby2(n,as,w n,ftype);case 4,n/wn=ellipord(wp,wstzrp,as); b,a=ellip(n,rp,as,w n,ftype);endprin t4(a,b,handles);case2%firtra nbw 二 0;n=0;hw=0;wn=(wp+wst)/2;switch ch32case1, %
54、rectangulartran bw=1.8;n=ceil(tranbw/abs(wls-wlp)+l;hw=boxcar(n);case2, %hanningtran bw=6.2;n=ceil(tranbw/abs(wls-wlp)+l;hw=han nin g(n);case3, %hammingtran bw=6.6;n=ceil(tranbw/abs(wls-wlp)+l;hw=hamming(n);case4, %blackma ntra nbw 二 11;n=ceil(tranbw/abs(wls-wlp)+l;hw=blackma n(n);case5, %kaisern=(rs-7.95)/2.285/abs(wls-wlp)+l;n=ceil(n)
溫馨提示
- 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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 不能玩火教案反思
- 海島冰輪初轉(zhuǎn)騰說課稿
- 農(nóng)忙季節(jié)臨時幫工合同
- 通信設(shè)備公司人才引進(jìn)合同樣板
- 車輛報廢回收企業(yè)管理辦法
- 通信工程配電房建設(shè)協(xié)議
- 人力資源服務(wù)審批指南
- 網(wǎng)絡(luò)應(yīng)急演練
- 設(shè)備買賣合同簽訂預(yù)付款政策
- 肌腱斷裂術(shù)后護(hù)理及功能鍛煉
- 國家開放大學(xué)《植物生理學(xué)》形考作業(yè)1-3+話題討論1-3參考答案
- GB/T 39415.1-2020包裝袋特征性能規(guī)范方法第1部分:紙袋
- GB 26512-2021商用車駕駛室乘員保護(hù)
- Tio2材料的性質(zhì)及應(yīng)用-課件
- 教育科研專題講座課件
- 語文課前三分鐘演講西塘古鎮(zhèn)課件
- 建筑工程常用英語詞匯
- 熱工基礎(chǔ)第一章
- 翻身拍背課件
- 2022版小學(xué)英語新課標(biāo)詳細(xì)解讀中小學(xué)英語教師培訓(xùn)PPT模板
- 全套課件-中文版AutoCAD-2020基礎(chǔ)教程-完整
評論
0/150
提交評論