课设论文matlabgui 界面设计.docx
《课设论文matlabgui 界面设计.docx》由会员分享,可在线阅读,更多相关《课设论文matlabgui 界面设计.docx(20页珍藏版)》请在冰豆网上搜索。
![课设论文matlabgui 界面设计.docx](https://file1.bdocx.com/fileroot1/2023-1/31/1072efb4-161d-4c2c-968e-13b9c6c05afc/1072efb4-161d-4c2c-968e-13b9c6c05afc1.gif)
课设论文matlabgui界面设计
、
functionvarargout=jy01(varargin)
%JY01M-fileforjy01.fig
%JY01,byitself,createsanewJY01orraisestheexisting
%singleton*.
%
%H=JY01returnsthehandletoanewJY01orthehandleto
%theexistingsingleton*.
%
%JY01('CALLBACK',hObject,eventData,handles,...)callsthelocal
%functionnamedCALLBACKinJY01.Mwiththegiveninputarguments.
%
%JY01('Property','Value',...)createsanewJY01orraisesthe
%existingsingleton*.Startingfromtheleft,propertyvaluepairsare
%appliedtotheGUIbeforejy01_OpeningFcngetscalled.An
%unrecognizedpropertynameorinvalidvaluemakespropertyapplication
%stop.Allinputsarepassedtojy01_OpeningFcnviavarargin.
%
%*SeeGUIOptionsonGUIDE'sToolsmenu.Choose"GUIallowsonlyone
%instancetorun(singleton)".
%
%Seealso:
GUIDE,GUIDATA,GUIHANDLES
%Edittheabovetexttomodifytheresponsetohelpjy01
%LastModifiedbyGUIDEv2.501-Jul-200513:
30:
37
%Begininitializationcode-DONOTEDIT
gui_Singleton=1;
gui_State=struct('gui_Name',mfilename,...
'gui_Singleton',gui_Singleton,...
'gui_OpeningFcn',@jy01_OpeningFcn,...
'gui_OutputFcn',@jy01_OutputFcn,...
'gui_LayoutFcn',[],...
'gui_Callback',[]);
ifnargin&&ischar(varargin{1})
gui_State.gui_Callback=str2func(varargin{1});
end
ifnargout
[varargout{1:
nargout}]=gui_mainfcn(gui_State,varargin{:
});
else
gui_mainfcn(gui_State,varargin{:
});
end
%Endinitializationcode-DONOTEDIT
%---Executesjustbeforejy01ismadevisible.
functionjy01_OpeningFcn(hObject,eventdata,handles,varargin)
%Thisfunctionhasnooutputargs,seeOutputFcn.
%hObjecthandletofigure
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%varargincommandlineargumentstojy01(seeVARARGIN)
%Choosedefaultcommandlineoutputforjy01
handles.output=hObject;
%Updatehandlesstructure
guidata(hObject,handles);
%UIWAITmakesjy01waitforuserresponse(seeUIRESUME)
%uiwait(handles.figure1);
%---Outputsfromthisfunctionarereturnedtothecommandline.
functionvarargout=jy01_OutputFcn(hObject,eventdata,handles)
%varargoutcellarrayforreturningoutputargs(seeVARARGOUT);
%hObjecthandletofigure
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%Getdefaultcommandlineoutputfromhandlesstructure
varargout{1}=handles.output;
%---Executesonbuttonpressinpushbutton2.
functionpushbutton2_Callback(hObject,eventdata,handles)
%hObjecthandletopushbutton2(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
[x]=wavread('01.wav');
sound(x);
subplot(4,1,1);
plot(x);
axis([1length(x)-11]);
ylabel('Speech');
enhance=filter([1-0.9375],1,x);
FrameLen=240;FrameInc=80;
yframe=enframe(x,FrameLen,FrameInc);
amp1=sum(abs(yframe),2);
subplot(4,1,2);
plot(amp1);
axis([1length(amp1)0max(amp1)]);
ylabel('Amp');
legend('amp1=¡Æ©¦x©¦');
amp2=sum(abs(yframe.*yframe),2);
subplot(4,1,3);
plot(amp2);
axis([1length(amp2)0max(amp2)]);
ylabel('Energy');
legend('amp1=¡Æ©¦x*x©¦');
tmp1=enframe(x(1:
end-1),FrameLen,FrameInc);
tmp2=enframe(x(2:
end),FrameLen,FrameInc);
signs=(tmp1.*tmp2)<0;
diffs=(tmp1-tmp2)>0.02;
zcr=sum(signs.*diffs,2);
subplot(4,1,4);
plot(zcr);
axis([1length(zcr)0max(zcr)]);
ylabel('ZCR');
legend('zcr');
functionf=enframe(x,win,inc)
nx=length(x(:
));
nwin=length(win);
if(nwin==1)
len=win;
else
len=nwin;
end
if(nargin<3)
inc=len;
end
nf=fix((nx-len+inc)/inc);
f=zeros(nf,len);
indf=inc*(0:
(nf-1)).';
inds=(1:
len);
f(:
)=x(indf(:
ones(1,len))+inds(ones(nf,1),:
));
if(nwin>1)
w=win(:
)';
f=f.*w(ones(nf,1),:
);
end
%---Executesonbuttonpressinpushbutton3.
functionpushbutton3_Callback(hObject,eventdata,handles)
%hObjecthandletopushbutton3(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
[our]=wavread('01.wav');
specgram_hw3p20(our,1024,512,10000);
specgram_hw3p20(our,512,256,10000);
function[spec]=specgram_hw3p20(x,winlgh,frmlgh,sampling_rate);
%specgram_hw3p20(x,winlgh,frmlgh,sampling_rate)
%
%functiontocomputeaspectrogram
%
%x=inputwaveform
%winlgh=windowlengthinsamples
%frmlgh=framelengthinsamples
%sampling_rate=samples/sec
%PARAMETERS
%sampling_rate=10000;%samplingrate
lfft=1024;%FFTlength
lfft2=lfft/2;
%winlgh=200;%(128)windowlength(insamples)
%frmlgh=10;%frameinterval(insamples)
noverlap=winlgh-frmlgh;
%x=x(1:
4500);
x=2.0*x/max(abs(x));
etime=length(x)/sampling_rate;
%---------------------------------------------------------------------------%
spec=abs(specgram(x,lfft,sampling_rate,winlgh,noverlap));
subplot(211);
plot((1:
length(x))/sampling_rate,x)
xlabel('Time(s)');
title('SPEECH');
axis([0etime-2.52.5]);
grid;
subplot(212)
imagesc(0:
.010:
etime,0:
1000:
(sampling_rate/2),log10(abs(spec)));axis('xy')
xlabel('Time(ms)'),ylabel('Frequency(Hz)');
title('SPECTROGRAM');
%---Executesonbuttonpressinpushbutton4.
functionpushbutton4_Callback(hObject,eventdata,handles)
%hObjecthandletopushbutton4(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
clc;
clear;
tic,
[y,fs]=wavread('01.wav');
L=length(y);
fw=y.*hamming(L);
r=real(log(fft(fw,L)))
pfw=cceps(fw);
rpfw=rceps(fw);
z=rpfw(1:
30);
p=pfw(31:
L)
logz=real(exp(fft(z,L)));
logp=real(fft(p));
subplot(3,2,1);plot(y);title('Ôʼ²¨ÐÎ')
subplot(3,2,3);plot(pfw);title('¸´µ¹Æ×')
subplot(3,2,5);plot(rpfw);title('ʵµ¹Æ×')
subplot(3,2,6);plot(logz);title('µ¹Æ×ÓòÂ˲¨ºóµÄ¶ÔÊý·ù¶ÈÆ×')
subplot(3,2,4);plot(r);title('¶ÔÊý·ù¶ÈÆ×')
subplot(3,2,2);plot(fw);title('¼Óº£Ã÷´°ºóµÄ²¨ÐÎ')
%---Executesonbuttonpressinpushbutton5.
functionpushbutton5_Callback(hObject,eventdata,handles)
%hObjecthandletopushbutton5(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
speech1_10k=wavread('01.wav',[10241273]);%È¡250µãµÄÓïÒôÐźÅ
sw=speech1_10k.*hamming(250);%a¼ÓººÃ÷´°
Rsw=xcorr(sw');%a×ÔÏà¹Ø
t=0.1:
0.1:
25;subplot(1,2,1);plot(t,sw);xlabel('ms');title('¼Ó´°ºóʱÓò²¨ÐÎ');
subplot(1,2,2);t=0.1:
0.1:
length(Rsw)/10;plot(t,Rsw);xlabel('ms');title('¼Ó´°ºó×Թز¨ÐÎ');
Rsw4=[Rsw(250:
253);Rsw(249:
252);Rsw(248:
251);Rsw(247:
250)];%Éú³É4*4×ÔÏà¹ØÕó
Rsw6=[Rsw(250:
255);Rsw(249:
254);Rsw(248:
253);Rsw(247:
252);Rsw(246:
251);Rsw(245:
250)];%Éú³É6*6×ÔÏà¹ØÕó
rea4=inv(Rsw4)*Rsw(251:
254)';%ÇóÔ¤²âϵÊý4
rea6=inv(Rsw6)*Rsw(251:
256)';%ÇóÔ¤²âϵÊý6
A4=sqrt(Rsw(250)-Rsw(251:
254)*rea4);%ÇóÔöÒæ
A6=sqrt(Rsw(250)-Rsw(251:
256)*rea6);%ÇóÔöÒæ
w=pi/512:
pi/512:
pi;%Éú³ÉÊä³öƵÂÊ·¶Î§
j=sqrt(-1);
FW4=rea4'*[exp(-j*w);exp(-j*w*2);exp(-j*w*3);exp(-j*w*4)];%ÔÚƵÂÊ·¶Î§ÇóÔ¤²âƵÏì
FW6=rea6'*[exp(-j*w);exp(-j*w*2);exp(-j*w*3);exp(-j*w*4);exp(-j*w*5);exp(-j*w*6)];%ÔÚƵÂÊ·¶Î§ÇóÔ¤²âƵÏì
HW4=A4./(1-FW4);%ÓÉÔ¤²âƵÏìÇó
HW6=A6./(1-FW6);%ÓÉÔ¤²âƵÏìÇó
FW2=fft(sw,1024);%ÐźŸµÁ¢Ò¶±ä»»
FW3=FW2(1:
512);
w=(1/1024:
1/1024:
0.5)*10000;
subplot(2,2,1);plot(w,log(abs(FW3)));xlabel('ƵÂÊhz');title('¼Ó´°ºóÐźÅƵÆ×');
subplot(2,2,2);plot(w,log(abs(HW4)),'g');xlabel('ƵÂÊhz');title('4¼«µãÄ£ÐÍƵÂÊÏìÓ¦');
subplot(2,2,3);plot(w,log(abs(HW6)),'r');xlabel('ƵÂÊhz');title('6¼«µãÄ£ÐÍƵÂÊÏìÓ¦');
subplot(2,2,4);plot(w,log(abs(FW3)),w,log(abs(HW4)),w,log(abs(HW6)));xlabel('ƵÂÊhz');title('ÈýÕ߱ȽÏ');
%---Executesonbuttonpressinpushbutton6.
functionpushbutton6_Callback(hObject,eventdata,handles)
%hObjecthandletopushbutton6(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
clear
Y=wavread('01.wav',[11800]);
x1=Y(271:
510);x2=Y(271:
510);x3=Y(271:
510);
%×ÔÏà¹Ø·¨
r=zeros(1,240);
fork=1:
240
forn=1:
240-k
r(k)=r(k)+x1(n)*x1(n+k);
end
end
j=1:
240;
subplot(2,2,2);plot(j,r);title('×ÔÏà¹Ø·¨´¦ÀíºóµÄ²¨ÐÎ')
subplot(2,2,1);plot(j,x1);title('Ôº¯Êý')
%Èýµçƽ·¨
fork1=1:
1:
240
ifx2(k1)>0
x2(k1)=1;
elseifx2(k1)==0
x2(k1)=0;
elseifx2(k1)<0
x2(k1)=-1;
end
end
end
end
j=1:
240;
subplot(2,2,3);plot(j,x2);title('Èýµçƽ·¨´¦ÀíºóµÄ²¨ÐÎ')
%ÖÐÐÄÏû²¨·¨
fork1=1:
1:
240
ma=abs(max(x3));
tc=0.6*ma;
ifx3(k1)>tc
x3(k1)=x3(k1)-tc;
elseifx3(k1)<-tc
x3(k1)=x3(k1)+tc;
else
x3(k1)=0;
end
end
end
j=1:
240;
subplot(2,2,4);plot(j,x3);title('ÖÐÐÄÏû²¨·¨´¦ÀíºóµÄ²¨ÐÎ')
%---Executesonbuttonpressinpushbutton7.
functionpushbutton7_Callback(hObject,eventdata,handles)
%hObjecthandletopushbutton7(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
clear
clc
winsize=256;%´°³¤
winsize=256;%´°³¤
n=0.04;%ÔëÉùˮƽ
[speech,fs,nbits]=wavread('01.wav');%¶ÁÈëÊý¾Ý
size=length(speech);
numofwin=floor(size/winsize);%Ö¡Êý
%¼Ó´°
ham=hamming(winsize)';%GeneratesHammingWindow
hamwin=zeros(1,size);%Vectorforwindowgain
enhanced=zeros(1,size);%Vectorforenhancedspeech
%²úÉú´øÔëÐźÅ
x=speech'+n*randn(1,size);%Contaminatessignalwithwhitenoise
%ÔëÉù¹À¼Æ
noisy=n*randn(1,winsize);%Sampleofnoise
N=fft(noisy);
nmag=abs(N);%Estimatednoisemagnitudespectrum
forq=1:
2*numofwin-1
frame=x(1+(q-1)*winsize/2:
winsize+(q-1)*winsize/2);%50percentov