基于MATLABGUI的数字实验信号平台的设计.docx

上传人:b****3 文档编号:27234140 上传时间:2023-06-28 格式:DOCX 页数:26 大小:789.30KB
下载 相关 举报
基于MATLABGUI的数字实验信号平台的设计.docx_第1页
第1页 / 共26页
基于MATLABGUI的数字实验信号平台的设计.docx_第2页
第2页 / 共26页
基于MATLABGUI的数字实验信号平台的设计.docx_第3页
第3页 / 共26页
基于MATLABGUI的数字实验信号平台的设计.docx_第4页
第4页 / 共26页
基于MATLABGUI的数字实验信号平台的设计.docx_第5页
第5页 / 共26页
点击查看更多>>
下载资源
资源描述

基于MATLABGUI的数字实验信号平台的设计.docx

《基于MATLABGUI的数字实验信号平台的设计.docx》由会员分享,可在线阅读,更多相关《基于MATLABGUI的数字实验信号平台的设计.docx(26页珍藏版)》请在冰豆网上搜索。

基于MATLABGUI的数字实验信号平台的设计.docx

基于MATLABGUI的数字实验信号平台的设计

 

基于MatlabGUI的数字实验信号平台的设计

 

学校:

太原工业学院

班级学号:

122022328

姓名:

马越

 

1.实现步骤:

第一步(主界面):

主界面

主要代码:

1.进入程序加载图片:

functionuntitledmain_OpeningFcn(hObject,eventdata,handles,varargin)

%Thisfunctionhasnooutputargs,seeOutputFcn.

%hObjecthandletofigure

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%varargincommandlineargumentstountitledmain(seeVARARGIN)

%Choosedefaultcommandlineoutputforuntitledmain

handles.output=hObject;

guidata(hObject,handles);

A=imread('D:

\Documents\MATLAB\background.jpg');

axes(handles.axes3);

imshow(A);

B=imread('D:

\Documents\MATLAB\hydrangeas.jpg');

axes(handles.axes5);

imshow(B);

2.pushbutton1按钮进入“基本离散信号及计算”界面

functionpushbutton1_Callback(hObject,eventdata,handles)

%hObjecthandletopushbutton1(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

close;

untitledjisuan;

3.pushbutton2按钮进入”matlab在dft中的应用”界面

functionpushbutton2_Callback(hObject,eventdata,handles)

%hObjecthandletopushbutton2(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

close;

dft;

4.pushbutton3按钮进入“离散时间系统的零极点分析”界面

functionpushbutton3_Callback(hObject,eventdata,handles)

%hObjecthandletopushbutton3(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

close;

zerosjidian;

5.pushbutton4按钮用于播放背景音乐

functionpushbutton4_Callback(hObject,eventdata,handles)

%hObjecthandletopushbutton4(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

globalplayer

%fori=1:

1:

100

[Y,Fs,nBits]=wavread('yirumaÁåÉù.wav');

player=audioplayer(Y,Fs,nBits);

forj=1:

1:

100

i=isplaying(player);

ifi==0

play(player);

end

end

%end

6.pushbutton5用于实现音乐的暂停/继续播放功能

functionpushbutton5_Callback(hObject,eventdata,handles)

%hObjecthandletopushbutton5(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

globalplayer

y=count();

ifmod(y,2)==0

pause(player);

else

resume(player);

end

第二步(主子界面):

1)

基本离散信号及计算---界面

 

主要代码如下:

 

1.listbox1用于列出选项清单

%---Executesonselectionchangeinlistbox1.

functionlistbox1_Callback(hObject,eventdata,handles)

%hObjecthandletolistbox1(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%Hints:

contents=cellstr(get(hObject,'String'))returnslistbox1contentsascellarray

%contents{get(hObject,'Value')}returnsselecteditemfromlistbox1

n=get(hObject,'value');

switchn

case1

close;

sinxulie;

case2

close;

shizhishuxulie;

case3

close;

fuzhishuxulie;

case4

close;

danweichongji;

case5

close;

danweijieyue;

case6

close;

boxingbianhuan;

end

2)

“matlab在dft中的应用”界面

主要代码如下:

1.按此按钮可以生成三角序列

functionpushbutton1_Callback(hObject,eventdata,handles)

%hObjecthandletopushbutton1(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

a=0;

n=str2num(get(handles.edit1,'string'));

x=zeros(size(n));

fori=1:

round(max(n)/2)

x(i)=a;

a=a+1;

end

forj=round(max(n)/2)+1:

max(n)

x(j)=a;

a=a-1;

end

axes(handles.axes1);

stem(n,x,'fill');

2.按此按钮生成对应三角序列的dft图像

functionpushbutton2_Callback(hObject,eventdata,handles)

%hObjecthandletopushbutton2(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

a=0;

n=str2num(get(handles.edit1,'string'));

foru=1:

round(max(n)/2)

x(u)=a;

a=a+1;

end

foru=round(max(n)/2)+1:

max(n)

x(u)=a;

a=a-1;

end

M=str2num(get(handles.edit2,'string'));

U=fft(x,M);

n1=0:

1:

M-1;

axes(handles.axes2);

stem(n1,abs(U),'fill');

3.按此按钮对dft图像进行抽取

functionpushbutton3_Callback(hObject,eventdata,handles)

%hObjecthandletopushbutton3(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

a=0;

n=str2num(get(handles.edit1,'string'));

foru=1:

round(max(n)/2)

x(u)=a;

a=a+1;

end

foru=round(max(n)/2)+1:

max(n)

x(u)=a;

a=a-1;

end

M=str2num(get(handles.edit3,'string'));

U=fft(x,M);

fori=1:

2:

M-1

Q(round(i/2))=U(i);

end

n1=0:

1:

round((M-2)/2);

axes(handles.axes3);

 

stem(n1,abs(Q),'fill');

4.按此按钮对相应三角序列进行周期延拓

functionpushbutton4_Callback(hObject,eventdata,handles)

%hObjecthandletopushbutton4(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

a=0;

n=str2num(get(handles.edit1,'string'));

foru=1:

round(max(n)/2)

x(u)=a;

a=a+1;

end

foru=round(max(n)/2)+1:

max(n)

x(u)=a;

a=a-1;

end

foru=max(n)+1:

1000

x(u)=0;

end

%x1=[x(1:

1:

size(n)),zeros(1,100)];

m=str2num(get(handles.edit4,'string'));

ifm

xc=x(mod(n,m)+1);

c=n;

else

n1=0:

1:

max(n)+100;

xc=x(mod(n1,m)+1);

c=n1;

end

axes(handles.axes4);

stem(c,xc,'fill');

3)

 

“离散时间系统的零极点分析”界面

 

第三步(次子界面的实现):

注:

次子界面为“基本离散信号及计算“的子界面

1)

 

正弦序列

主要代码:

此按钮绘制“正弦序列“图像

functionpushbutton3_Callback(hObject,eventdata,handles)

%hObjecthandletopushbutton3(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

n=0:

40;x=cos(0.2*pi*n+pi/2);

axes(handles.axes1);

stem(n,x);

2)

实指数序列

主要代码:

1.此按钮用于生成a=5/4时的实指数序列

functionpushbutton3_Callback(hObject,eventdata,handles)

%hObjecthandletopushbutton3(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

n=0:

20;a=5/4;x=a.^n;

%subplot(2,2,1);

axes(handles.axes6);

stem(n,x,'filled');

2.此按钮用于生成a=-5/4时的实指数序列

%---Executesonbuttonpressinpushbutton4.

functionpushbutton4_Callback(hObject,eventdata,handles)

%hObjecthandletopushbutton4(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

n=0:

20;a=-5/4;x=a.^n;

%subplot(2,2,3);

axes(handles.axes8);

stem(n,x,'filled');

3.此按钮用于生成a=3/4时的实指数序列

%---Executesonbuttonpressinpushbutton5.

functionpushbutton5_Callback(hObject,eventdata,handles)

%hObjecthandletopushbutton5(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

n=0:

20;a=3/4;x=a.^n;

%subplot(2,2,2);

axes(handles.axes7);

stem(n,x,'filled');

4.此按钮用于生成a=-3/4时的实指数序列

%---Executesonbuttonpressinpushbutton6.

functionpushbutton6_Callback(hObject,eventdata,handles)

%hObjecthandletopushbutton6(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

n=0:

20;a=-3/4;x=a.^n;

%subplot(2,2,4);

axes(handles.axes9);

stem(n,x,'filled');

3)

复指数序列(r>1)

主要代码:

此按钮用于生成r>1的复指数序列

functionpushbutton3_Callback(hObject,eventdata,handles)

%hObjecthandletopushbutton3(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

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,2,4);

axes(handles.axes4);stem(n,(180/pi)*angle(x),'filled');

复指数序列(r=1)

主要代码:

此按钮用于生成r=1的复指数序列

functionpushbutton2_Callback(hObject,eventdata,handles)

%hObjecthandletopushbutton2(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

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);stem(n,(180/pi)*angle(x),'filled');

复指数序列(0

主要代码:

此按钮用于生成0

functionpushbutton1_Callback(hObject,eventdata,handles)

%hObjecthandletopushbutton1(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

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);stem(n,(180/pi)*angle(x),'filled');

4)

单位冲击序列

主要代码:

此按钮生成”单位冲击序列”

functionpushbutton1_Callback(hObject,eventdata,handles)

%hObjecthandletopushbutton1(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

k=-10:

10;n=length(k);x=zeros(1,n);x(1,11)=1;

axes(handles.axes1);

stem(k,x,'filled');

5)

单位阶跃序列

主要代码:

此按钮生成“单位阶跃序列”

functionpushbutton1_Callback(hObject,eventdata,handles)

%hObjecthandletopushbutton1(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

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');

holdon;stem(k,u,'filled');

6)

f1[x]+f2[x](序列相加),f1[x]*f2[x](序列相

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 经管营销 > 销售营销

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1