课设论文matlabgui 界面设计Word格式文档下载.docx
《课设论文matlabgui 界面设计Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《课设论文matlabgui 界面设计Word格式文档下载.docx(20页珍藏版)》请在冰豆网上搜索。
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{:
%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);
%Getdefaultcommandlineoutputfromhandlesstructure
varargout{1}=handles.output;
%---Executesonbuttonpressinpushbutton2.
functionpushbutton2_Callback(hObject,eventdata,handles)
%hObjecthandletopushbutton2(seeGCBO)
[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)]);
Amp'
legend('
amp1=¡
Æ
©
¦
x©
'
amp2=sum(abs(yframe.*yframe),2);
subplot(4,1,3);
plot(amp2);
axis([1length(amp2)0max(amp2)]);
Energy'
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)]);
ZCR'
zcr'
functionf=enframe(x,win,inc)
nx=length(x(:
));
nwin=length(win);
if(nwin==1)
len=win;
len=nwin;
if(nargin<
3)
inc=len;
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),:
%---Executesonbuttonpressinpushbutton3.
functionpushbutton3_Callback(hObject,eventdata,handles)
%hObjecthandletopushbutton3(seeGCBO)
[our]=wavread('
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'
)
Time(ms)'
),ylabel('
Frequency(Hz)'
SPECTROGRAM'
%---Executesonbuttonpressinpushbutton4.
functionpushbutton4_Callback(hObject,eventdata,handles)
%hObjecthandletopushbutton4(seeGCBO)
clc;
clear;
tic,
[y,fs]=wavread('
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);
¸
´
µ
¹
×
subplot(3,2,5);
plot(rpfw);
Ê
subplot(3,2,6);
plot(logz);
Ó
ò
Â
Ë
º
ó
Ä
¶
ý
·
ù
È
subplot(3,2,4);
plot(r);
subplot(3,2,2);
plot(fw);
£
Ã
÷
°
%---Executesonbuttonpressinpushbutton5.
functionpushbutton5_Callback(hObject,eventdata,handles)
%hObjecthandletopushbutton5(seeGCBO)
speech1_10k=wavread('
[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'
±
subplot(1,2,2);
t=0.1:
length(Rsw)/10;
plot(t,Rsw);
Rsw4=[Rsw(250:
253);
Rsw(249:
252);
Rsw(248:
251);
Rsw(247:
250)];
%É
ú
³
É
4*4×
Õ
Rsw6=[Rsw(250:
255);
254);
Rsw(246:
Rsw(245:
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*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)));
hz'
subplot(2,2,2);
plot(w,log(abs(HW4)),'
g'
4¼
«
Í
subplot(2,2,3);
plot(w,log(abs(HW6)),'
r'
6¼
subplot(2,2,4);
plot(w,log(abs(FW3)),w,log(abs(HW4)),w,log(abs(HW6)));
ß
½
%---Executesonbuttonpressinpushbutton6.
functionpushbutton6_Callback(hObject,eventdata,handles)
%hObjecthandletopushbutton6(seeGCBO)
clear
Y=wavread('
[11800]);
x1=Y(271:
510);
x2=Y(271:
x3=Y(271:
%×
r=zeros(1,240);
fork=1:
240
forn=1:
240-k
r(k)=r(k)+x1(n)*x1(n+k);
end
j=1:
240;
plot(j,r);
À
í
plot(j,x1);
º
¯
ç
fork1=1:
1:
ifx2(k1)>
x2(k1)=1;
elseifx2(k1)==0
x2(k1)=0;
elseifx2(k1)<
x2(k1)=-1;
plot(j,x2);
%Ö
û
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;
plot(j,x3);
Ö
%---Executesonbuttonpressinpushbutton7.
functionpushbutton7_Callback(hObject,eventdata,handles)
%hObjecthandletopushbutton7(seeGCBO)
clc
winsize=256;
%´
n=0.04;
%Ô
ë
®
[speech,fs,nbits]=wavread('
%¶
¾
Ý
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