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

本文介绍了在MATLAB中设计IIR数字滤波器的两种方法——典型设计和完全设计。通过实例展示了如何使用巴特沃斯滤波器进行语音去噪,包括调制信号、载波信号和调幅信号的处理。同时,提供了MATLAB GUI代码实现滤波器选择和信号显示的功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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代码问题可私信交流。

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

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

matlab科研助手

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

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

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

打赏作者

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

抵扣说明:

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

余额充值