【滤波器】基于汉宁窗FIR滤波器实现语音信号加噪去噪含Matlab源码
【滤波器】基于汉宁窗FIR滤波器实现语音信号加噪去噪含Matlab源码
TT_Matlab
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,完整matlab代码或者程序定制加qq1575304183。
1 简介
结合数字滤波器的理论基础和设计方法,在MATLAB程序语言环境下,设计出有限长单位脉冲响应(FIR)数字滤波器,同时利用GUI界面设计FIR数字滤波器人机交互平台,该系统平台界面直观、操作简单且功能齐全,可实现对加噪语音信号的去噪滤波功能.平台主要包括语音信号、加噪信号、FIR数字滤波器设计和去噪信号四个模块,用户可根据读入的语音信号及噪声信号特点调整滤波器技术指标,实现滤波器的优化设计,最终达到FIR数字滤波器对语音信号的去噪处理效果.
2 部分代码
function varargout = filter_config(varargin)
%
FILTER_CONFIG M-file
for
filter_config.fig
%
FILTER_CONFIG, by itself, creates a new FILTER_CONFIG or raises the existing
%
singleton*.
%
%
H = FILTER_CONFIG returns the handle to a new FILTER_CONFIG or the handle to
%
the existing singleton*.
%
%
FILTER_CONFIG(
’CALLBACK’
,hObject,eventData,handles,...) calls the
local
%
function
named CALLBACK
in
FILTER_CONFIG.M with the given input arguments.
%
%
FILTER_CONFIG(
’Property’
,
’Value’
,...) creates a new FILTER_CONFIG or raises the
%
existing singleton*. Starting from the left, property value pairs are
%
applied to the GUI before filter_config_OpeningFcn gets called. An
%
unrecognized property name or invalid value makes property application
%
stop. All inputs are passed to filter_config_OpeningFcn via varargin.
%
%
*See GUI Options on GUIDE
’s Tools menu. Choose "GUI allows only one
%
instance to run (singleton)".
%
%
See also: GUIDE, GUIDATA, GUIHANDLES
%
Edit the above text to modify the response to help filter_config
%
Last Modified by GUIDE v2.5 20-Nov-2012 22:45:50
%
Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(’gui_Name’, mfilename, ...
’gui_Singleton’, gui_Singleton, ...
’gui_OpeningFcn’, @filter_config_OpeningFcn, ...
’gui_OutputFcn’, @filter_config_OutputFcn, ...
’gui_LayoutFcn’, [] , ...
’gui_Callback’, []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
%
End initialization code - DO NOT EDIT
%
--- Executes just before filter_config is made visible.
function filter_config_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 of MATLAB
%
handles structure with handles and user data (see GUIDATA)
%
varargin command line arguments to filter_config (see VARARGIN)
%
Choose default command line output for filter_config
handles.output = hObject;
%
Update handles structure
guidata(hObject, handles);
%
UIWAIT makes filter_config wait for user response (see UIRESUME)
%
uiwait(handles.panal1);
%
--- Outputs from this function are returned to the command line.
function varargout = filter_config_OutputFcn(hObject, eventdata, handles)
%
varargout cell array for returning output args (see VARARGOUT);
%
hObject handle to figure
%
eventdata reserved - to be defined in a future version of MATLAB
%
handles structure with handles and user data (see GUIDATA)
%
Get default command line output from handles structure
varargout{1} = handles.output;
axes(handles.axes1);
plot(20*log10(abs(fft(bs))));
axis([0 3*Wn -inf inf]);
axes(handles.axes2);
plot(angle(fft(bs)));
axis([-inf inf -inf inf]);
setappdata(handles.panal1,’bl1’,bl1);
setappdata(handles.panal1,’bl2’,bl2);
setappdata(handles.panal1,’bf_window’,bf_window);
setappdata(handles.panal1,’bh’,bh);
setappdata(handles.panal1,’bs’,bs);
setappdata(handles.panal1,’Wn’,Wn);
setappdata(0,’bs’,bs);
setappdata(0,’bh’,bh);
setappdata(0,’bl1’,bl1);
%
--- 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)
%
--- Executes on button press in close.
function close_Callback(hObject, eventdata, handles)
%
hObject handle to close (see GCBO)
%
eventdata reserved - to be defined in a future version of MATLAB
%
handles structure with handles and user data (see GUIDATA)
clc;
close filter_config;
function Wn_Callback(hObject, eventdata, handles)
%
hObject handle to Wn (see GCBO)
%
eventdata reserved - to be defined in a future version of MATLAB
%
handles structure with handles and user data (see GUIDATA)
%
Hints: get(hObject,’
String
’) returns contents of Wn as text
%
str2double(get(hObject,’
String
’)) returns contents of Wn as a double
%
--- Executes during object creation, after setting all properties.
function Wn_CreateFcn(hObject, eventdata, handles)
%
hObject handle to Wn (see GCBO)
%
eventdata reserved - to be defined in a future version of MATLAB
%
handles empty - handles not created until after all CreateFcns called
%
Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function band_Callback(hObject, eventdata, handles)
%
hObject handle to band (see GCBO)
%
eventdata reserved - to be defined in a future version of MATLAB
%
handles structure with handles and user data (see GUIDATA)
%
Hints: get(hObject,’
String
’) returns contents of band as text
%
str2double(get(hObject,’
String
’)) returns contents of band as a double
%
--- Executes during object creation, after setting all properties.
function band_CreateFcn(hObject, eventdata, handles)
%
hObject handle to band (see GCBO)
%
eventdata reserved - to be defined in a future version of MATLAB
%
handles empty - handles not created until after all CreateFcns called
%
Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function Wdel_Callback(hObject, eventdata, handles)
%
hObject handle to Wdel (see GCBO)
%
eventdata reserved - to be defined in a future version of MATLAB
%
handles structure with handles and user data (see GUIDATA)
%
Hints: get(hObject,’
String
’) returns contents of Wdel as text
%
str2double(get(hObject,’
String
’)) returns contents of Wdel as a double
%
--- Executes during object creation, after setting all properties.
function Wdel_CreateFcn(hObject, eventdata, handles)
%
hObject handle to Wdel (see GCBO)
%
eventdata reserved - to be defined in a future version of MATLAB
%
handles empty - handles not created until after all CreateFcns called
%
Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
%
--- Executes on selection change in filter_choose.
function filter_choose_Callback(hObject, eventdata, handles)
%
hObject handle to filter_choose (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 filter_choose contents as cell array
%
contents{get(hObject,’
Value
’)} returns selected item from filter_choose
bl1=getappdata(handles.panal1,’bl1’);
bl2=getappdata(handles.panal1,’bl2’);
bf_window=getappdata(handles.panal1,’bf_window’);
bh=getappdata(handles.panal1,’bh’);
bs=getappdata(handles.panal1,’bs’);
Wn=getappdata(handles.panal1,’Wn’);
select=get(handles.filter_choose,’value’);
switch select
case 1
axes(handles.axes1);
plot(20*log10(abs(fft(bs))));
axis([0 3*Wn -40 1]);
axes(handles.axes2);
plot(angle(fft(bs)));
axis([0 Wn -4 1]);
case 2
axes(handles.axes1);
plot(20*log10(abs(fft(bl1))));
axis([0 3*Wn -40 1]);
axes(handles.axes2);
plot(angle(fft(bl1)));
axis([0 Wn -4 1]);
case 3
axes(handles.axes1);
plot(20*log10(abs(fft(bl2))));
axis([0 3*Wn -40 1]);
axes(handles.axes2);
plot(angle(fft(bl2)));
axis([0 Wn -4 1]);
case 4
axes(handles.axes1);
plot(20*log10(abs(fft(bf_window))));
axis([0 3*Wn -40 1]);
axes(handles.axes2);
plot(angle(fft(bf_window)));
axis([0 Wn -4 1]);
case 5
axes(handles.axes1);
plot(20*log10(abs(fft(bh))));
axis([0 3*Wn -40 1]);
axes(handles.axes2);
plot(angle(fft(bh)));
axis([Wn 2*Wn -4 1]);
end
%
--- Executes during object creation, after setting all properties.
function filter_choose_CreateFcn(hObject, eventdata, handles)
%
hObject handle to filter_choose (see GCBO)
%
eventdata reserved - to be defined in a future version of MATLAB
%
handles empty - handles not created until after all CreateFcns called
%
Hint: popupmenu controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
3 仿真结果
4 参考文献
[1]冯浩. 基于MATLAB GUI的FIR数字滤波器语音信号去噪处理[J]. 菏泽学院学报, 2016, 38(5):5.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
-
2023年血糖新标准公布,不是3.9-6.1,快来看看你的血糖正常吗? 2023-02-07
-
2023年各省最新电价一览!8省中午执行谷段电价! 2023-01-03
-
GB 55009-2021《燃气工程项目规范》(含条文说明),2022年1月1日起实施 2021-11-07
-
PPT导出高分辨率图片的四种方法 2022-09-22
-
2023年最新!国家电网27家省级电力公司负责人大盘点 2023-03-14
-
全国消防救援总队主官及简历(2023.2) 2023-02-10
-
盘点 l 中国石油大庆油田现任领导班子 2023-02-28
-
我们的前辈!历届全国工程勘察设计大师完整名单! 2022-11-18
-
关于某送变电公司“4·22”人身死亡事故的快报 2022-04-26
