• 【无标题】


    ✅作者简介:热爱科研的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电子书和数学建模资料

  • 相关阅读:
    BurpSuit官方实验室之信息泄露
    【中国知名企业高管团队】系列25:360
    动态代理看这个就够了
    svc和ingress的关系
    【STM32学习】I2C通信协议 | OLED屏
    vue2文件下载和合计表格
    arthas修改日志级别
    再谈基于Ocelot API网关和IdentityServer的API认证与授权
    OpenAI即将推出新一代AI模型DALL-E 3;用AI进行天然产物药物发现的综述
    CSS基础
  • 原文地址:https://blog.csdn.net/qq_59747472/article/details/128186636