当前位置:网站首页>【信号去噪】基于FFT和FIR实现信号去噪附matlab代码
【信号去噪】基于FFT和FIR实现信号去噪附matlab代码
2022-06-11 18:53:00 【Matlab科研工作室】
1 简介
【信号去噪】基于FFT和FIR实现信号去噪附matlab代码
2 部分代码
% Proyek Sinyal dan Sistem - 02% FFT, FIR, and Denoise% Universitas : Universitas Indonesiafunction varargout = FFT_IvanWidjanarko_1806148706_Sinsis02(varargin)gui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ...'gui_Singleton', gui_Singleton, ...'gui_OpeningFcn', @FFT_IvanWidjanarko_1806148706_Sinsis02_OpeningFcn, ...'gui_OutputFcn', @FFT_IvanWidjanarko_1806148706_Sinsis02_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{:});elsegui_mainfcn(gui_State, varargin{:});end% End initialization code - DO NOT EDIT% --- Executes just before FFT_IvanWidjanarko_1806148706_Sinsis02 is made visible.function FFT_IvanWidjanarko_1806148706_Sinsis02_OpeningFcn(hObject, eventdata, handles, varargin)%disable buttonset(handles.ReplayButton,'enable','off');set(handles.FIRFilterButton,'enable','off');set(handles.PlayFIRFilterButton,'enable','off');set(handles.FFTFilterButton,'enable','off');set(handles.PlayFFTFilterButton,'enable','off');set(handles.DenoiseButton,'enable','off');set(handles.PlayDenoiseButton,'enable','off');handles.output = hObject;handles.state = 0;handles.Fs = 8192;handles.lowBound = 300handles.highBound = 3800global nBits;nBits = 16;global recObj;recObj = audiorecorder(handles.Fs,nBits,1);set(recObj,'TimerPeriod',0.05,'TimerFcn',{@audioTimerCallback,handles});xlabel(handles.OriginalTimeDomain,'Time');ylabel(handles.OriginalTimeDomain, 'Amplitude');xlabel(handles.FFTFrequency,'Frequency (Hz)');ylabel(handles.FFTFrequency,'|Y(f)|')xlabel(handles.FIRFrequency,'Frequency (Hz)');ylabel(handles.FIRFrequency,'|Y(f)|')xlabel(handles.DenoiseTimeDomain,'Time');ylabel(handles.DenoiseTimeDomain, 'Amplitude');% Update handles structureguidata(hObject, handles);% --- Outputs from this function are returned to the command line.function varargout = FFT_IvanWidjanarko_1806148706_Sinsis02_OutputFcn(hObject, eventdata, handles)varargout{1} = handles.output;function audioTimerCallback(hObject,event,handles)if(isempty(hObject))return;endsignal = getaudiodata(hObject);plot(handles.OriginalTimeDomain, signal);% --- Executes on button press in RecordButton.function RecordButton_Callback(hObject, eventdata, handles)%prepare parameterglobal recObj;if handles.state == 0disp('Start Recording')set(hObject,'String','Pause');record(recObj);handles.state =1 ;%disable buttonset(handles.ReplayButton,'enable','off');set(handles.FIRFilterButton,'enable','off');set(handles.PlayFIRFilterButton,'enable','off');set(handles.FFTFilterButton,'enable','off');set(handles.PlayFFTFilterButton,'enable','off');set(handles.DenoiseButton,'enable','off');set(handles.PlayDenoiseButton,'enable','off');elsedisp('Stop Recording')set(hObject,'String','Record');stop(recObj);handles.state = 0;%enable buttonset(handles.ReplayButton,'enable','on');set(handles.FIRFilterButton,'enable','on');set(handles.PlayFIRFilterButton,'enable','on');set(handles.FFTFilterButton,'enable','on');set(handles.PlayFFTFilterButton,'enable','on');set(handles.DenoiseButton,'enable','on');set(handles.PlayDenoiseButton,'enable','on');xlabel(handles.OriginalTimeDomain,'Time');ylabel(handles.OriginalTimeDomain, 'Amplitude');xlabel(handles.FFTFrequency,'Frequency (Hz)');ylabel(handles.FFTFrequency,'|Y(f)|')endguidata(hObject,handles)% --- Executes on button press in btn_stoprecord.function btn_stoprecord_Callback(hObject, eventdata, handles)disp('Stop Recording')global recordFlag;recordFlag = 0;% --- Executes on button press in ReplayButton.function ReplayButton_Callback(hObject, eventdata, handles)global recObj;global nBits;sig = getaudiodata(recObj);[n m] = size(sig)load gong.mat;soundsc(sig, handles.Fs, nBits);% --- Executes on button press in FFTFilterButton.function FFTFilterButton_Callback(hObject, eventdata, handles)global recObj;sig = getaudiodata(recObj);nfft = 2^nextpow2(length(sig));filterSound = conv(sig,h,'valid');plot(handles.DenoiseTimeDomain, sig);xlabel(handles.DenoiseTimeDomain,'Time');ylabel(handles.DenoiseTimeDomain,'Amplitude')% --- Executes on button press in PlayDenoiseButton.function PlayDenoiseButton_Callback(hObject, eventdata, handles)global filterSoundglobal nBitsload gong.mat;soundsc(filterSound, handles.Fs, nBits);% --- Executes on button press in ExitButton.function ExitButton_Callback(hObject, eventdata, handles)cl = questdlg('Do you want to EXIT?','EXIT',...'Yes','No','No');switch clcase 'Yes'close();clear all;return;case 'No'quit cancel;end% --- Executes during object creation, after setting all properties.function OriginalTimeDomain_CreateFcn(hObject, eventdata, handles)% hObject handle to OriginalTimeDomain (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: place code in OpeningFcn to populate OriginalTimeDomain% --- If Enable == 'on', executes on mouse press in5 pixel border.% --- Otherwise, executes on mouse press in 5 pixel border or over ExitButton.function ExitButton_ButtonDownFcn(hObject, eventdata, handles)% hObject handle to ExitButton (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% --- Executes on mouse press over axes background.function OriginalTimeDomain_ButtonDownFcn(hObject, eventdata, handles)% hObject handle to OriginalTimeDomain (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% --- Executes when Project is resized.function Project_SizeChangedFcn(hObject, eventdata, handles)% hObject handle to Project (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的振动信号去噪研究[J]. 电子测试, 2011(7):4.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
边栏推荐
- Mysql深入完全学习---阶段1---学习总述
- 如何在 SAP BTP 上 手动执行 workflow
- Quanzhi technology T3 development board (4-core arm cortex-a7) - mqtt communication protocol case
- Tips for using apipost
- 力扣刷题——二叉树的层序遍历
- 防止敌方坦克重叠
- Non recursive traversal of binary tree
- Labelme for image data annotation
- Visual slam lecture notes-10-1
- User group actions
猜你喜欢

Force deduction questions -- create a string based on a binary tree

Specific methods for JS to realize full screen display

*Jetpack notes understanding of lifecycle ViewModel and livedata
Mysql从0到1的完全深入学习--阶段二---基础篇
Make a static tank

全志科技T3开发板(4核ARM Cortex-A7)——MQTT通信协议案例

Force deduction 23 questions, merging K ascending linked lists

Quanzhi Technology T3 Development Board (4 Core ARM Cortex - A7) - mqtt Communication Protocol case
用户信息管理的功能开发

牛客刷题——Fibonacci数列
随机推荐
Do you know that public fields are automatically filled in
用户组的操作
Uploading and downloading of necessary files in development
Force deduction questions -- create a string based on a binary tree
Use transformers to convert TF model to pytorch model
Function development of user information management
*Use of jetpack notes room
Force buckle 34 finds the first and last positions of elements in a sorted array
Cf:b. array determinations
cf:A. Print a Pedestal (Codeforces logo?)【简单遍历模拟】
非递归实现二叉树的前、中、后序遍历
開發中必備的文件的上傳與下載
牛客刷题——二叉搜索树与双向链表
Niu Ke swipes the question -- converting a string to an integer
己方坦克发射子弹
Niu Ke's questions -- two sorting methods
记录一下phpstudy配置php8.0和php8.1扩展redis
实现可以继续上局
Introduction to basic use and pit closure of BigDecimal
添加自己喜欢的背景音乐