【滤波器】基于低通、带通、高通滤波器实现语音去噪含Matlab源码

简介: 【滤波器】基于低通、带通、高通滤波器实现语音去噪含Matlab源码

1 简介

在本文中,我们分别研究了在MATLAB环境下IIR数字滤波器的典型设计和完全设计等方法。 典型设计是先按一定规则将给出的数字滤波器的技术指标转换成模拟低通滤波器的技术指标,据此产生模拟滤波器原型,然后把模拟低通滤波器原型转换成模拟低通、高通、带通滤波器,最后再把模拟滤波器转换成数字滤波器。 完全设计方法中我们利用函数直接设计出低通、高通、带通滤波器,并分别用巴特沃斯(Butterworth)滤波器来实现语音去噪。

2 部分代码

function varargout = AMtiaozhi(varargin)% AMTIAOZHI M-file for AMtiaozhi.fig%      AMTIAOZHI, by itself, creates a new AMTIAOZHI or raises the existing%      singleton*.%%      H = AMTIAOZHI returns the handle to a new AMTIAOZHI or the handle to%      the existing singleton*.%%      AMTIAOZHI('CALLBACK',hObject,eventData,handles,...) calls the local%      function named CALLBACK in AMTIAOZHI.M with the given input arguments.%%      AMTIAOZHI('Property','Value',...) creates a new AMTIAOZHI or raises the%      existing singleton*.  Starting from the left, property value pairs are%      applied to the GUI before AMtiaozhi_OpeningFunction gets called.  An%      unrecognized property name or invalid value makes property application%      stop.  All inputs are passed to AMtiaozhi_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 AMtiaozhi% Last Modified by GUIDE v2.5 10-May-2010 16:42:40% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name',       mfilename, ...                   'gui_Singleton',  gui_Singleton, ...                   'gui_OpeningFcn', @AMtiaozhi_OpeningFcn, ...                   'gui_OutputFcn',  @AMtiaozhi_OutputFcn, ...                   'gui_LayoutFcn',  [] , ...                   'gui_Callback',   []);if nargin & isstr(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 AMtiaozhi is made visible.function AMtiaozhi_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 AMtiaozhi (see VARARGIN)% Choose default command line output for AMtiaozhihandles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes AMtiaozhi wait for user response (see UIRESUME)% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.function varargout = AMtiaozhi_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;% --- Executes during object creation, after setting all properties.function popupmenu1_CreateFcn(hObject, eventdata, handles)% hObject    handle to popupmenu1 (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endset(hObject, 'String', {'调制信号', '载波信号','已调波信号'});% --- Executes on selection change in popupmenu1.function popupmenu1_Callback(hObject, eventdata, handles)% hObject    handle to popupmenu1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array%        contents{get(hObject,'Value')} returns selected item from popupmenu1% --- Executes during object creation, after setting all properties.function popupmenu2_CreateFcn(hObject, eventdata, handles)% hObject    handle to popupmenu2 (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endset(hObject, 'String', {'高通滤波', '低通滤波','带通滤波'});% --- Executes on selection change in popupmenu2.function popupmenu2_Callback(hObject, eventdata, handles)% hObject    handle to popupmenu2 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns popupmenu2 contents as cell array%        contents{get(hObject,'Value')} returns selected item from popupmenu2% --- Executes on button press in pushbutton1.function pushbutton1_Callback(hObject, eventdata, handles)popup_sel_index = get(handles.popupmenu1, 'Value');switch popup_sel_index    case 1        dt=0.01;        t=0:dt:10;Fs=1/dt;        e=sinc(t-5);%调制信号        elength=length(e);%求采样点个数        E=fft(e,elength);%快速傅里叶变换        %fe=-Fs/2:elength:Fs/2;        En=fftshift(E);%对fft输出进行重新排列,将零频分量移到频谱中心        axes(handles.axes1);        plot(t,e);title('调制信号');                                xlabel('时间s');        ylabel('强度值');        axis([0 10 1.1*min(e) 1.1*max(e)]);        axes(handles.axes2);        plot(abs(En));title('调制信号频谱');        axis([0 1000 1.1*min(abs(En)) 1.1*max(abs(En))]);        set(handles.axes2,'Xticklabel',[-50,-30,-10,10,30,50])                                xlabel('频率Hz');        ylabel('幅度值');    case 2        dt=0.01;        t=0:dt:10;Fs=1/dt;        s=cos(60*pi*t)+cos(40*pi*t)+cos(20*pi*t);%载波信号        slength=length(s);%求采样点个数        S=fft(s);%快速傅里叶变换        %fs=linspace(-Fs/2,Fs/2,slength);        Sn=fftshift(S);        axes(handles.axes3);        plot(t,s);title('载波信号');                                xlabel('时间s');        ylabel('强度值');        axes(handles.axes4);plot(abs(Sn));title('载波信号频谱');                axis([0 1000 1.1*min(abs(Sn)) 1.1*max(abs(Sn))]);        set(handles.axes4,'Xticklabel',[-50,-30,-10,10,30,50])                                xlabel('频率Hz');        ylabel('幅度值');    case 3        dt=0.01;        t=0:dt:10;Fs=1/dt;        s=cos(60*pi*t)+cos(40*pi*t)+cos(20*pi*t);%载波信号        e=sinc(t-5);%调制信号        p=e.*s;%调制        plength=length(p);        P=fft(p);        %fp=linspace(-Fs/2,Fs/2,plength);        Pn=fftshift(P);        axes(handles.axes5);        plot(t,p);title('调幅信号');                                xlabel('时间s');        ylabel('强度值');        axis([0 10 1.1*min(p) 1.1*max(p)]);        axes(handles.axes6);        plot(abs(Pn));title('调幅信号频谱');                        axis([0 1000 1.1*min(abs(Pn)) 1.1*max(abs(Pn))]);        set(handles.axes6,'Xticklabel',[-50,-30,-10,10,30,50])                                        xlabel('频率Hz');        ylabel('幅度值');end% hObject    handle to pushbutton1 (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 pushbutton2.function pushbutton2_Callback(hObject, eventdata, handles)pend% 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)

3 仿真结果

4 参考文献

[1]王蔚. MATLAB环境下的数字滤波器设计及其应用[D]. 苏州大学, 2002.

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

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



相关文章
|
27天前
|
存储 算法 数据可视化
基于 MATLAB的GUI信号处理界面设计 源码+运行截图
基于 MATLAB的GUI信号处理界面设计 源码+运行截图
46 2
|
3月前
|
存储 算法 Serverless
【matlab】matlab基于DTW和HMM方法数字语音识别系统(源码+音频文件+GUI界面)【独一无二】
【matlab】matlab基于DTW和HMM方法数字语音识别系统(源码+音频文件+GUI界面)【独一无二】
|
3月前
|
存储 Serverless
【matlab】matlab实现倒谱法基音频率检测和共振峰检测(源码+音频文件)【独一无二】
【matlab】matlab实现倒谱法基音频率检测和共振峰检测(源码+音频文件)【独一无二】
|
4月前
|
机器学习/深度学习 算法 调度
Matlab|基于改进鲸鱼优化算法的微网系统能量优化管理matlab-源码
基于改进鲸鱼优化算法的微网系统能量管理源码实现,结合LSTM预测可再生能源和负荷,优化微网运行成本与固定成本。方法应用于冷热电联供微网,结果显示经济成本平均降低4.03%,提高经济效益。代码包括数据分段、LSTM网络定义及训练,最终展示了一系列运行结果图表。
基于高通滤波器的ECG信号滤波及心率统计matlab仿真
**摘要:** 使用MATLAB2022a,实施高通滤波对ECG信号预处理,消除基线漂移,随后分析心率。系统仿真展示效果,核心代码涉及IIR HPF设计,如二阶滤波器的差分方程。通过滤波后的信号,检测R波计算RR间期,从而得到心率。滤波与R波检测是心电生理研究的关键步骤,平衡滤波性能与计算资源是设计挑战。
|
3月前
|
安全
【2023高教社杯】D题 圈养湖羊的空间利用率 问题分析、数学模型及MATLAB代码
本文介绍了2023年高教社杯数学建模竞赛D题的圈养湖羊空间利用率问题,包括问题分析、数学模型建立和MATLAB代码实现,旨在优化养殖场的生产计划和空间利用效率。
191 6
【2023高教社杯】D题 圈养湖羊的空间利用率 问题分析、数学模型及MATLAB代码
|
3月前
|
存储 算法 搜索推荐
【2022年华为杯数学建模】B题 方形件组批优化问题 方案及MATLAB代码实现
本文提供了2022年华为杯数学建模竞赛B题的详细方案和MATLAB代码实现,包括方形件组批优化问题和排样优化问题,以及相关数学模型的建立和求解方法。
124 3
【2022年华为杯数学建模】B题 方形件组批优化问题 方案及MATLAB代码实现
|
3月前
|
数据采集 存储 移动开发
【2023五一杯数学建模】 B题 快递需求分析问题 建模方案及MATLAB实现代码
本文介绍了2023年五一杯数学建模竞赛B题的解题方法,详细阐述了如何通过数学建模和MATLAB编程来分析快递需求、预测运输数量、优化运输成本,并估计固定和非固定需求,提供了完整的建模方案和代码实现。
88 0
【2023五一杯数学建模】 B题 快递需求分析问题 建模方案及MATLAB实现代码
|
6月前
|
数据安全/隐私保护
耐震时程曲线,matlab代码,自定义反应谱与地震波,优化源代码,地震波耐震时程曲线
地震波格式转换、时程转换、峰值调整、规范反应谱、计算反应谱、计算持时、生成人工波、时频域转换、数据滤波、基线校正、Arias截波、傅里叶变换、耐震时程曲线、脉冲波合成与提取、三联反应谱、地震动参数、延性反应谱、地震波缩尺、功率谱密度
基于混合整数规划的微网储能电池容量规划(matlab代码)
基于混合整数规划的微网储能电池容量规划(matlab代码)

热门文章

最新文章