DATE: 2021.3.28
1、前言
在大学课题设计和毕业设计中,要求实现数字信号处理算法的matlab GUI界面,包括
- 信号产生模块: 根据用户输入的参数如幅度和频率,产生两个正弦信号,对这两个正弦信号叠加生成要处理的模拟信号。
- 抽样模块: 根据用户设置的抽样频率对模拟信号在时域上进行抽样,产生一时域 离散信号。
- 频谱演示模块: 用FFT对时域离散信号进行谱分析,用来显示 信号的频谱图。
- IIR 滤波器生成模块:根据用户输入的截止频率和衰减指标设计出巴特沃斯数字低通滤波器,并显示出滤波器的幅度特性和相位特性曲线。
- FIR 滤波器生成模块:根据输入的窗口长度和截止频率用窗函数法设计FIR数字滤波器,可供选择的窗函数有矩形窗、汉宁窗等。同时对其工作原理、构建方法和误码性能进行分析。
若需要相关代码可以在关注和订阅博主专栏之后,加博主QQ(2963033731)索取(代码付费提供)。
2、数字信号处理仿真实现效果
2.1、信号产生模块
2.2、抽样模块
2.3、FFT频谱分析
2.4、IIR滤波器
2.5、FIR滤波器
3、部分matlab程序
function varargout = hlp_signal_processing_guideGUI(varargin)
% SIGNAL_PROCESSING_GUIDEGUI MATLAB code for signal_processing_guideGUI.fig
% SIGNAL_PROCESSING_GUIDEGUI, by itself, creates a new SIGNAL_PROCESSING_GUIDEGUI or raises the existing
% singleton*.
%
% H = SIGNAL_PROCESSING_GUIDEGUI returns the handle to a new SIGNAL_PROCESSING_GUIDEGUI or the handle to
% the existing singleton*.
%
% SIGNAL_PROCESSING_GUIDEGUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in SIGNAL_PROCESSING_GUIDEGUI.M with the given input arguments.
%
% SIGNAL_PROCESSING_GUIDEGUI('Property','Value',...) creates a new SIGNAL_PROCESSING_GUIDEGUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before signal_processing_guideGUI_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to signal_processing_guideGUI_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 signal_processing_guideGUI
% Last Modified by GUIDE v2.5 08-May-2020 13:50:14
% Begin initialization code - DO NOT EDIT
%
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @hlp_signal_processing_guideGUI_OpeningFcn, ...
'gui_OutputFcn', @hlp_signal_processing_guideGUI_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 signal_processing_guideGUI is made visible.
function hlp_signal_processing_guideGUI_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 signal_processing_guideGUI (see VARARGIN)
% Choose default command line output for signal_processing_guideGUI
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes signal_processing_guideGUI wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = hlp_signal_processing_guideGUI_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;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles) %%进入主界面
% 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)
run('hlp_signal_processing_MainGUI');
set(handles.figure1,'visible','off');
% --- 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)
close;
% --- Executes during object creation, after setting all properties.
function figure1_CreateFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
dis = imread('bluesky.jpg');
imshow(dis)
THE END!