数字信号处理实验报告--含噪语音信号的分析

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

大连理工大学实验报告

实验四含噪语音信号的分析

一实验代码及程序

利用callback在.m文件中对各个模块进行代码的编辑(下面列出主要部分):1、输入音频信号部分:

[filename,filepath]=uigetfile('.wav','选择音频文件');

if(filename==0)

return;

end

audeofile= strcat(filepath,filename);

[handles.tdata,fs,handles.NBITS]=wavread(audeofile);

%绘制时域波形图

t = [0:1/fs:(length(handles.tdata)-1)/fs];%信号的时域长度

subplot(handles.fig1);

plot(t, handles.tdata);

%绘制频谱图

N = length(t);

fftdata = fft(handles.tdata,N);

fdata = abs(fftdata);

df = fs / N;

f = [0 : df : df * (N - 1)] - fs / 2;%求频率

subplot(handles.fig2);

plot(f, fftshift(fdata) );

guidata(hObject, handles);

2、设置低通部分:

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 GUIDA TA)

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

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

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

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

wp=2*pi*fp/1000;

wr=2*pi*fr/1000;

%Ap=3;

%Ar=20;

Ts=1/1000;

Op=2/Ts*tan(wp/2);

Os=2/Ts*tan(wr/2)

[N,Wn]=buttord(Op,Os,Ap,Ar,'s');

[z,p,k]=buttap(N)

[b,a]=zp2tf(z,p,k);

[B,A]=lp2lp(b,a,Wn);

[Bz,Az]=bilinear(B,A,1000);

[f,w]=freqz(Bz,Az);

f_mag=abs(f);

f_ang=angle(f);

%subplot(2,1,1); plot(w/pi,abs(f_mag));

%subplot(2,1,2); plot(w/pi,20*log(abs(f_mag)));

%N = length(t);

%fftdata = fft(handles.tdata,N);

%fdata = abs(w);

%df = fs / N;

%f = [0 : df : df * (N - 1)] - fs / 2;%求频率

subplot(handles.fig3);

plot(w/pi, f_mag );

guidata(hObject, handles);

y = filtfilt(Bz,Az,handles.tdata);

handles.tdata=y;

%绘制时域波形图

fs=1000;

t = [0:1/fs:(length(handles.tdata)-1)/fs];%信号的时域长度

subplot(handles.fig4);

plot(t,handles.tdata);

%绘制频谱图

N = length(t);

fftdata = fft(handles.tdata,N);

fdata = abs(fftdata);

df = fs / N;

f = [0 : df : df * (N - 1)] - fs / 2;%求频率

subplot(handles.fig5);

plot(f, fftshift(fdata) );

guidata(hObject, handles);

3 设置高通部分

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 GUIDA TA) fp=str2num(get(handles.edit1,'string'));

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

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

相关文档
最新文档