基于MATLABGUI的數(shù)字實(shí)驗(yàn)信號(hào)平臺(tái)的設(shè)計(jì)_第1頁(yè)
基于MATLABGUI的數(shù)字實(shí)驗(yàn)信號(hào)平臺(tái)的設(shè)計(jì)_第2頁(yè)
基于MATLABGUI的數(shù)字實(shí)驗(yàn)信號(hào)平臺(tái)的設(shè)計(jì)_第3頁(yè)
基于MATLABGUI的數(shù)字實(shí)驗(yàn)信號(hào)平臺(tái)的設(shè)計(jì)_第4頁(yè)
基于MATLABGUI的數(shù)字實(shí)驗(yàn)信號(hào)平臺(tái)的設(shè)計(jì)_第5頁(yè)
已閱讀5頁(yè),還剩17頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、 基于Matlab GUI的數(shù)字實(shí)驗(yàn)信號(hào)平臺(tái)的設(shè)計(jì)學(xué) 校:太原工業(yè)學(xué)院班級(jí)學(xué)號(hào): 122022328 姓 名: 馬 越 1. 實(shí)現(xiàn)步驟:第一步(主界面): 主界面主要代碼:1.進(jìn)入程序加載圖片:function untitledmain_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.% hObject handle to figure% eventdata reserved - to be defined in a future version

2、 of MATLAB% handles structure with handles and user data (see GUIDATA)% varargin command line arguments to untitledmain (see VARARGIN)% Choose default command line output for untitledmainhandles.output = hObject; guidata(hObject, handles);A = imread('D:DocumentsMATLABbackground.jpg');axes(ha

3、ndles.axes3);imshow(A);B = imread('D:DocumentsMATLABhydrangeas.jpg');axes(handles.axes5);imshow(B);2.pushbutton1按鈕進(jìn)入“基本離散信號(hào)及計(jì)算”界面function pushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (see GCBO)% eventdata reserved - to be defined in a future version of MAT

4、LAB% handles structure with handles and user data (see GUIDATA)close;untitledjisuan;3. pushbutton2按鈕進(jìn)入”matlab在dft中的應(yīng)用”界面function pushbutton2_Callback(hObject, eventdata, handles)% hObject handle to pushbutton2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles stru

5、cture with handles and user data (see GUIDATA)close;dft;4.pushbutton3按鈕進(jìn)入“離散時(shí)間系統(tǒng)的零極點(diǎn)分析”界面function pushbutton3_Callback(hObject, eventdata, handles)% hObject handle to pushbutton3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user dat

6、a (see GUIDATA)close;zerosjidian;5.pushbutton4按鈕用于播放背景音樂(lè)function pushbutton4_Callback(hObject, eventdata, handles)% hObject handle to pushbutton4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)global player%for

7、i=1:1:100Y,Fs,nBits = wavread('yiruma ÁåÉù.wav');player=audioplayer(Y,Fs,nBits);for j=1:1:100i=isplaying(player); if i=0 play(player); endend%end6.pushbutton5用于實(shí)現(xiàn)音樂(lè)的暫停/繼續(xù)播放功能function pushbutton5_Callback(hObject, eventdata, handles)% hObject handle to pushbutton5 (see GCB

8、O)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)global playery=count();if mod(y,2)=0 pause(player);else resume(player);end第二步(主子界面):1) 基本離散信號(hào)及計(jì)算-界面主要代碼如下:1.listbox1用于列出選項(xiàng)清單% - Executes on selection change in listbox1.fun

9、ction listbox1_Callback(hObject, eventdata, handles)% hObject handle to listbox1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % Hints: contents = cellstr(get(hObject,'String') returns listbox1 content

10、s as cell array% contentsget(hObject,'Value') returns selected item from listbox1n = get(hObject,'value');switch n case 1 close; sinxulie; case 2 close; shizhishuxulie; case 3 close; fuzhishuxulie; case 4 close; danweichongji; case 5 close; danweijieyue; case 6 close; boxingbianhuan;

11、end2) “matlab在dft中的應(yīng)用”界面主要代碼如下:1.按此按鈕可以生成三角序列function pushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)a=0;n=str2num(get(handles.edi

12、t1,'string');x=zeros(size(n);for i=1:round(max(n)/2) x(i)=a; a=a+1;endfor j=round(max(n)/2)+1:max(n) x(j)=a; a=a-1;endaxes(handles.axes1);stem(n,x,'fill');2.按此按鈕生成對(duì)應(yīng)三角序列的dft圖像function pushbutton2_Callback(hObject, eventdata, handles)% hObject handle to pushbutton2 (see GCBO)% eventda

13、ta reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)a=0;n=str2num(get(handles.edit1,'string');for u=1:round(max(n)/2) x(u)=a; a=a+1;endfor u=round(max(n)/2)+1:max(n) x(u)=a; a=a-1;end M=str2num(get(handles.edit2,'string'

14、;);U=fft(x,M);n1=0:1:M-1;axes(handles.axes2);stem(n1,abs(U),'fill');3.按此按鈕對(duì)dft圖像進(jìn)行抽取function pushbutton3_Callback(hObject, eventdata, handles)% hObject handle to pushbutton3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user

15、data (see GUIDATA)a=0;n=str2num(get(handles.edit1,'string');for u=1:round(max(n)/2) x(u)=a; a=a+1;endfor u=round(max(n)/2)+1:max(n) x(u)=a; a=a-1;endM=str2num(get(handles.edit3,'string');U=fft(x,M);for i=1:2:M-1 Q(round(i/2)=U(i);endn1=0:1:round(M-2)/2);axes(handles.axes3);stem(n1,ab

16、s(Q),'fill');4.按此按鈕對(duì)相應(yīng)三角序列進(jìn)行周期延拓function pushbutton4_Callback(hObject, eventdata, handles)% hObject handle to pushbutton4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)a=0;n=str2num(get(handles.edit1,&#

17、39;string');for u=1:round(max(n)/2) x(u)=a; a=a+1;endfor u=round(max(n)/2)+1:max(n) x(u)=a; a=a-1;endfor u=max(n)+1:1000 x(u)=0;end%x1=x(1:1:size(n),zeros(1,100); m=str2num(get(handles.edit4,'string');if m<max(n) xc=x(mod(n,m)+1); c=n;else n1=0:1:max(n)+100; xc=x(mod(n1,m)+1); c=n1;en

18、daxes(handles.axes4);stem(c,xc,'fill');3) “離散時(shí)間系統(tǒng)的零極點(diǎn)分析”界面第三步(次子界面的實(shí)現(xiàn)):注:次子界面為“基本離散信號(hào)及計(jì)算“的子界面1) 正弦序列主要代碼:此按鈕繪制“正弦序列“圖像function pushbutton3_Callback(hObject, eventdata, handles)% hObject handle to pushbutton3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handle

19、s structure with handles and user data (see GUIDATA)n=0:40;x=cos(0.2*pi*n+pi/2);axes(handles.axes1);stem(n,x);2) 實(shí)指數(shù)序列主要代碼:1.此按鈕用于生成a=5/4時(shí)的實(shí)指數(shù)序列function pushbutton3_Callback(hObject, eventdata, handles)% hObject handle to pushbutton3 (see GCBO)% eventdata reserved - to be defined in a future version

20、 of MATLAB% handles structure with handles and user data (see GUIDATA)n=0:20;a=5/4;x=a.n;%subplot(2,2,1);axes(handles.axes6);stem(n,x,'filled'); 2. 此按鈕用于生成a=-5/4時(shí)的實(shí)指數(shù)序列% - Executes on button press in pushbutton4.function pushbutton4_Callback(hObject, eventdata, handles)% hObject handle to pu

21、shbutton4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n=0:20;a=-5/4;x=a.n;%subplot(2,2,3);axes(handles.axes8);stem(n,x,'filled'); 3. 此按鈕用于生成a=3/4時(shí)的實(shí)指數(shù)序列% - Executes on button press in pushbutton5.func

22、tion pushbutton5_Callback(hObject, eventdata, handles)% hObject handle to pushbutton5 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n=0:20;a=3/4;x=a.n;%subplot(2,2,2);axes(handles.axes7);stem(n,x,'filled

23、9;); 4. 此按鈕用于生成a=-3/4時(shí)的實(shí)指數(shù)序列% - Executes on button press in pushbutton6.function pushbutton6_Callback(hObject, eventdata, handles)% hObject handle to pushbutton6 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n=

24、0:20;a=-3/4;x=a.n;%subplot(2,2,4);axes(handles.axes9);stem(n,x,'filled');3) 復(fù)指數(shù)序列(r>1)主要代碼:此按鈕用于生成r>1的復(fù)指數(shù)序列function pushbutton3_Callback(hObject, eventdata, handles)% hObject handle to pushbutton3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles str

25、ucture with handles and user data (see GUIDATA)n=0:20;r=1.2;w=pi/4;x=(r*exp(i*w).n;%subplot(2,2,1);axes(handles.axes1);stem(n,real(x),'filled');%subplot(2,2,2);axes(handles.axes2);stem(n,imag(x),'filled');%subplot(2,2,3);axes(handles.axes3);stem(n,abs(x),'filled');%subplot(2,

26、2,4);axes(handles.axes4);stem(n,(180/pi)*angle(x),'filled'); 復(fù)指數(shù)序列(r=1)主要代碼:此按鈕用于生成r=1的復(fù)指數(shù)序列function pushbutton2_Callback(hObject, eventdata, handles)% hObject handle to pushbutton2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles a

27、nd user data (see GUIDATA)n=0:20;r=1;w=pi/4;x=(r*exp(i*w).n;%subplot(2,2,1);axes(handles.axes1);stem(n,real(x),'filled');%subplot(2,2,2);axes(handles.axes2);stem(n,imag(x),'filled');%subplot(2,2,3);axes(handles.axes3);stem(n,abs(x),'filled');%subplot(2,2,4);axes(handles.axes4

28、);stem(n,(180/pi)*angle(x),'filled'); 復(fù)指數(shù)序列(0<r<1)主要代碼:此按鈕用于生成0<r<1的復(fù)指數(shù)序列function pushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user

29、 data (see GUIDATA)n=0:20;r=0.9;w=pi/4;x=(r*exp(i*w).n;%subplot(2,2,1);axes(handles.axes1);stem(n,real(x),'filled');%subplot(2,2,2);axes(handles.axes2);stem(n,imag(x),'filled');%subplot(2,2,3);axes(handles.axes3);stem(n,abs(x),'filled');%subplot(2,2,4);axes(handles.axes4);ste

30、m(n,(180/pi)*angle(x),'filled');4) 單位沖擊序列主要代碼:此按鈕生成”單位沖擊序列”function pushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)k=-10:1

31、0;n=length(k);x=zeros(1,n);x(1,11)=1;axes(handles.axes1);stem(k,x,'filled');5) 單位階躍序列主要代碼:此按鈕生成“單位階躍序列”function pushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure wit

32、h handles and user data (see GUIDATA)k=-10:-1;kk=0:10;n=length(k);nn=length(kk);u=zeros(1,n);uu=ones(1,nn);axes(handles.axes1);stem(kk,uu,'filled');hold on;stem(k,u,'filled');6)f1x+f2x(序列相加),f1x*f2x(序列相乘)主要代碼:1.此按鈕生成序列f1xfunction pushbutton1_Callback(hObject, eventdata, handles)% hOb

33、ject handle to pushbutton1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n1=str2num(get(handles.edit2,'string');x1=cos(0.2*pi*n1+pi/2);axes(handles.axes3);stem(n1,x1,'filled');title('f1x'

34、;); 2.此按鈕生成f1x+f2x圖像% - Executes on button press in pushbutton2.function pushbutton2_Callback(hObject, eventdata, handles)% hObject handle to pushbutton2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n1=str2num

35、(get(handles.edit2,'string');x1=cos(0.2*pi*n1+pi/2);n2=str2num(get(handles.edit4,'string');p=length(n2);x2=zeros(1,p);x2(1,6)=1;y3,n=sigadd(x1,n1,x2,n2);axes(handles.axes5); stem(n,y3,'filled');title('f1k+f2k'); 3.此按鈕生成序列f2x% - Executes on button press in pushbutton3.

36、function pushbutton3_Callback(hObject, eventdata, handles)% hObject handle to pushbutton3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n2=str2num(get(handles.edit4,'string');p=length(n2);x2=zeros(1,p);

37、x2(1,6)=1; axes(handles.axes4);stem(n2,x2,'filled');title('f2x');4.此按鈕生成f1x*f2xfunction pushbutton6_Callback(hObject, eventdata, handles)% hObject handle to pushbutton6 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and us

38、er data (see GUIDATA)n1=str2num(get(handles.edit2,'string');x1=cos(0.2*pi*n1+pi/2);n2=str2num(get(handles.edit4,'string');p=length(n2);x2=zeros(1,p);x2(1,6)=1;y3,n=sigcheng(x1,n1,x2,n2);axes(handles.axes6);stem(n,y3,'filled');title('f1k*f2k'); f1x-3,f2x-3(序列時(shí)移)主要代碼:此按鈕生成f1x-3,f2x-3的圖像function pushbutton7_Callback(hObject, eventdata, handles)% hObject handle to pushbutton7 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles s

溫馨提示

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

評(píng)論

0/150

提交評(píng)論