【滤波器】基于汉宁窗FIR滤波器实现语音信号加噪去噪含Matlab源码

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 EDITgui_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});endif 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_confighandles.output = hObject;% Update handles structureguidata(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 structurevarargout{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');endfunction 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');endfunction 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_choosebl1=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代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

matlab科研助手

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值