【滤波器】基于Matlab设计巴斯 切比雪夫 椭圆 低通高通带通带阻数字滤波器附GUI界面
创始人
2024-04-17 12:31:24
0

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

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

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

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

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

⛄ 内容介绍

介绍了基于Matlab的IIR数字滤波器设计方法.先确定数字滤波器的性能指标,再按照一定的映射规则(冲激响应不变法或双线性变换法)变换成模拟滤波器的性能指标,然后采用一定的逼近方法(巴特沃斯型或切比雪夫型)设计模拟滤波器,最后将模拟滤波器按照同样的映射规则转变成数字滤波器.同时介绍了设计IIR数字滤波器常用的Matlab函数.通过Matlab实验仿真,利用介绍的数字滤波器的设计方法,成功地设计出了满足预定指标的各型IIR数字滤波器.

⛄ 部分代码

function varargout = Butterworth_bandpass(varargin)

% Begin initialization code - DO NOT EDIT

gui_Singleton = 1;

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

                   'gui_Singleton',  gui_Singleton, ...

                   'gui_OpeningFcn', @Butterworth_bandpass_OpeningFcn, ...

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

function Butterworth_bandpass_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 Butterworth_bandpass (see VARARGIN)

% Choose default command line output for Butterworth_bandpass

handles.output = hObject;

% Update handles structure

guidata(hObject, handles);

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

% uiwait(handles.figure1);

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

function varargout = Butterworth_bandpass_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 during object creation, after setting all properties.

function muestreo_CreateFcn(hObject, eventdata, handles)

% hObject    handle to muestreo (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 button press in menu.

function menu_Callback(hObject, eventdata, handles)

% hObject    handle to menu (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

FILTER

close Butterworth_bandpass

% --- Executes on button press in calcular.

function calcular_Callback(hObject, eventdata, handles)

% hObject    handle to calcular (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

Fs=str2double(get(handles.muestreo,'String'));

Fpb=str2double(get(handles.b_pb,'String'));

Fpb1=str2double(get(handles.dos0,'String'));

Fsb=str2double(get(handles.b_rb,'String'));

Fsb1=str2double(get(handles.dos1,'String'));

Rpb=str2double(get(handles.edit4,'String'));

Rsb=str2double(get(handles.edit5,'String'));

if (Fs<0 | isnan(Fs))

   errordlg('El valor debe ser num閞ico positivo ',' ERROR ');

   set(handles.muestreo,'String',10);

   handles.muestreo=10;

end

if (Fpb<0 | isnan(Fpb))

   errordlg('El valor debe ser num閞ico positivo ',' ERROR ');

   set(handles.b_pb,'String',1);

   handles.muestreo=1;

end

if (Fsb<0 | isnan(Fsb))

   errordlg('El valor debe ser num閞ico positivo ',' ERROR ');

   set(handles.b_rb,'String',4);

   handles.b_rb=4;

end

if (Rpb<0 | isnan(Rpb))

   errordlg('El valor debe ser num閞ico positivo ',' ERROR ');

   set(handles.edit4,'String',10);

   handles.edit4=10;

end

if (Rsb<0 | isnan(Rsb))

   errordlg('El valor debe ser num閞ico positivo ',' ERROR ');

   set(handles.edit5,'String',30);

   handles.edit5=30;

end

fs=Fs/2;    %Frec. de muestreo

fpb=[Fpb Fpb1]/fs;  %Frec. de borde pasa banda

fpb

fsb=[Fsb Fsb1]/fs; % Frec. de borde rechaza banda

fsb

%------------------------------------------------------------

[n,wn]=buttord(fpb, fsb, Rpb, Rsb);

[b,a] =butter(n,wn,'bandpass');

[H,w]=freqz(b,a,512,1);

%Trazado de la respuesta en Magnitud

axes(handles.axes1)

plot(w,20*log10(abs(H)));

grid on;

title (['Filtro pasa-bajos, Respuesta en magnitud, orden=', num2str(n)]);

xlabel('frecuencia');

ylabel('H(f) db')

axis([0 0.5 -Rsb-10 0])

axes(handles.axes2)

plot(w,angle(H));

grid on;

title (['Filtro pasa-bajos, Respuesta en magnitud, orden=', num2str(n)]);

xlabel('frecuencia')

ylabel('醤gulo de H rad')

%Resp al impulso

axes(handles.axes3)

[y,t]= impz(b,a,60);

stem(t,y);

title (['Filtro pasa-bajos, Respuesta al impulso, orden=', num2str(n)]);

%Ploteo de los polos y ceros

z= roots(b);  %Zeros

p = roots(a);  % Polos

axes(handles.axes4)

zplane(z,p)

title(['Trazade polos y ceros para Butter'])

⛄ 运行结果

⛄ 参考文献

[1]王艳文, 史先红. 基于MATLAB的切比雪夫Ⅱ型数字低通滤波器设计[J]. 科技视界, 2013(17):1.

[2]贾建科, 韩团军, 朱宁洲. 基于MatlabGUI的模拟带通滤波器的设计[J]. 现代电子技术, 2010, 33(10):5.

⛄ Matlab代码关注

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

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

相关内容

热门资讯

前端-session、jwt 目录:   (1)session (2&#x...
linux入门---制作进度条 了解缓冲区 我们首先来看看下面的操作: 我们首先创建了一个文件并在这个文件里面添加了...
关于测试,我发现了哪些新大陆 关于测试 平常也只是听说过一些关于测试的术语,但并没有使用过测试工具。偶然看到编程老师...
前缀和与对数器与二分法 1. 前缀和 假设有一个数组,我们想大量频繁的去访问L到R这个区间的和,...
nodejs:本地安装nvm实... 一、背景-使用不同版本node的原因 vue3+ts、nuxt3版本,node...
JAVA集合知识整理 Java集合知识整理 HashMap相关 HashMap的底层数据结构:jdk1.8之...
无刷直流电机介绍及单片机控制实... 无刷直流电机介绍及单片机控制实例前言基本概念优势与劣势使用寿命基本结构使用单片机控制实例电子调速器&...
fwdiary(2) dp2 1.传纸条  AcWing 275. 传纸条 - AcWing 走两条路,走一条最大的...
常用的DOS命令 常用的DOS命令 DOS(Disk Operating System,磁...
<C++> 类和对象(下) 1.const成员函数将const修饰的“成员函数”称之为const成员函数,cons...