【信号处理】基于matlab模拟信号处理滤波系统

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

智能优化算法       神经网络预测       雷达通信       无线传感器        电力系统

信号处理              图像处理               路径规划       元胞自动机        无人机 

⛄ 内容介绍

本文针对"信号与系统"这门课程存在物理概念抽象,学生难以理解等情况,利用MATLAB强大的图形处理功能,结合教学中的重难点,设计了基于MATLAB GUI界面的连续信号滤波处理系统.系统主要功能分数据读取和数据处理.数据读取功能主要是读取待分析的连续时间信号,读取后还可以显示该信号的时域波形和频谱图;数据处理功能主要是设计低通,高通,带通三种典型的滤波器对信号进行滤波处理,处理后的时域图和频谱图能在界面上显示出来.这样,滤波器特性,信号通过滤波器滤波前后的时频变化都可以通过这个系统进行分析.总的来说,系统可分为4个大的模块,分别是:信号读取模块,时域分析模块,滤波器设计模块,频域分析模块.每个模块内部可以对信号进行相应的操作.以实际的连续信号为例,给出了低通滤波器,高通滤波器,带通滤波器的设计,在GUI界面上进行了信号滤波仿真,比较了连续信号通过滤波器前后的效果.结果证明,利用MATLAB平台分析和处理信号与系统,不仅能加深理解,而且还能得到满意的效果.

⛄ 部分代码

function varargout = Lowpass(varargin)

% LOWPASS MATLAB code for Lowpass.fig

%      LOWPASS, by itself, creates a new LOWPASS or raises the existing

%      singleton*.

%

%      H = LOWPASS returns the handle to a new LOWPASS or the handle to

%      the existing singleton*.

%

%      LOWPASS('CALLBACK',hObject,eventData,handles,...) calls the local

%      function named CALLBACK in LOWPASS.M with the given input arguments.

%

%      LOWPASS('Property','Value',...) creates a new LOWPASS or raises the

%      existing singleton*.  Starting from the left, property value pairs are

%      applied to the GUI before Lowpass_OpeningFcn gets called.  An

%      unrecognized property name or invalid value makes property application

%      stop.  All inputs are passed to Lowpass_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 Lowpass

% Last Modified by GUIDE v2.5 24-Jan-2015 09:39:53

% Begin initialization code - DO NOT EDIT

gui_Singleton = 1;

gui_State = struct('gui_Name',       mfilename, ...

                   'gui_Singleton',  gui_Singleton, ...

                   'gui_OpeningFcn', @Lowpass_OpeningFcn, ...

                   'gui_OutputFcn',  @Lowpass_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 Lowpass is made visible.

function Lowpass_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 Lowpass (see VARARGIN)

% Choose default command line output for Lowpass

handles.output = hObject;

% Update handles structure

guidata(hObject, handles);

% UIWAIT makes Lowpass wait for user response (see UIRESUME)

% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.

function varargout = Lowpass_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)

wp = str2double(get(handles.edit1,'string'));

ws = str2double(get(handles.edit2,'string'));

if wp<ws

    %invisibal the subwindow, visibal main window

    set(gcf,'visible','off');

    main('visible','on');

else

    errordlg('错误!低通滤波器通带截止频率应小于阻带截止频率!','错误提示');

end

function edit1_Callback(hObject, eventdata, handles)

% hObject    handle to edit1 (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 edit1 as text

%        str2double(get(hObject,'String')) returns contents of edit1 as a double

% --- Executes during object creation, after setting all properties.

function edit1_CreateFcn(hObject, eventdata, handles)

% hObject    handle to edit1 (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

function edit2_Callback(hObject, eventdata, handles)

% hObject    handle to edit2 (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 edit2 as text

%        str2double(get(hObject,'String')) returns contents of edit2 as a double

% --- Executes during object creation, after setting all properties.

function edit2_CreateFcn(hObject, eventdata, handles)

% hObject    handle to edit2 (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

function edit3_Callback(hObject, eventdata, handles)

% hObject    handle to edit3 (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 edit3 as text

%        str2double(get(hObject,'String')) returns contents of edit3 as a double

% --- Executes during object creation, after setting all properties.

function edit3_CreateFcn(hObject, eventdata, handles)

% hObject    handle to edit3 (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

function edit4_Callback(hObject, eventdata, handles)

% hObject    handle to edit4 (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 edit4 as text

%        str2double(get(hObject,'String')) returns contents of edit4 as a double

% --- Executes during object creation, after setting all properties.

function edit4_CreateFcn(hObject, eventdata, handles)

% hObject    handle to edit4 (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 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 = cellstr(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 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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

    set(hObject,'BackgroundColor','white');

end

% --- 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)

global fs; global a; global b;

wp = str2double(get(handles.edit1,'string'));

ws = str2double(get(handles.edit2,'string'));

rp = str2double(get(handles.edit3,'string'));

rs = str2double(get(handles.edit4,'string'));

sel = get(handles.popupmenu1,'value');

if wp<ws

    switch sel

        case 1  %butterworth

            [n,Wn] = buttord(2*wp/fs,2*ws/fs,rp,rs);

            [b,a] = butter(n,Wn);

        case 2  %chelbshelf I

            [n,Wn] = cheb1ord(2*wp/fs,2*ws/fs,rp,rs);

            [b,a] = cheby1(n,rp,Wn);

        case 3  %chelbshelf II

            [n,Wn] = cheb2ord(2*wp/fs,2*ws/fs,rp,rs);

            [b,a] = cheby2(n,rs,Wn);

        case 4

            [n,Wn] = ellipord(2*wp/fs,2*ws/fs,rp,rs);

            [b,a] = ellip(n,rp,rs,Wn);

    end

    [h,f] = freqz(b,a,1024,fs);

    mag = abs(h);

    phase = angle(h);

    axes(handles.axes1),loglog(f,mag)

    axes(handles.axes2),semilogx(f,phase)

else

    errordlg('错误!低通滤波器通带截止频率应小于阻带截止频率!','错误提示');

end

⛄ 运行结果

⛄ 参考文献

[1] 窦林涛, 程健庆, 李素民. 基于Matlab的雷达信号处理系统仿真[J]. 指挥控制与仿真, 2006, 28(2):5.

[2] Dong Haibing, 董海兵, Luo Xuelian,等. 连续信号滤波处理系统设计和仿真[C]// 湖南省高校电子信息技术教学研究会. 湖南省高校电子信息技术教学研究会, 2013.

[3] 罗大鹏, 叶敦范, 王勇. 基于Matlab的信号处理系统[J]. 现代电子技术, 2004, 27(19):4.

[4] 王宏, 贾新民. 信号处理基础[M]. 机械工业出版社, 2007.

⛳️ 代码获取关注我

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

❤️ 关注我领取海量matlab电子书和数学建模资料

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Matlab科研辅导帮

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

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

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

打赏作者

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

抵扣说明:

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

余额充值