【滤波器】基于matlab GUI分数延迟滤波器设计【含Matlab源码 1347期】

一、分数延迟滤波器简介

1 概述
随着数字通信技术的发展, 可变分数延迟 (Variable Fractional Delay, VFD) 滤波已经成为信号处理中的重要技术, 它被广泛应用于数字通信、语音编码及合成、采样率转换、模数转换等科技领域, 相关研究也日益增多。Farrow结构[1]是一种有效的VFD滤波器设计结构, 它包括一套并行的固定系数FIR子滤波器和一个提供现场可变延迟的可调参数。为实现Farrow结构, 研究人员提出了多种多样的设计方法, 但这些方法有时只能找到局部最优解。本文同样采用Farrow结构来实现对VFD滤波器的设计, 设计的关键问题是FIR子滤波器系数的非线性最优化。

目前, 能够在非线性最优化问题中得出全局鲁棒最优解的进化算法已经成功地应用于VFD滤波器设计中。

2 VFD滤波器和Farrow结构
理想的VFD FIR滤波器可以对输入信号进行延迟, 延迟包含有整数部分和分数部分, 并且其在通带内的幅度响应为单位常数。其系统函数为:
在这里插入图片描述
其中, D表示固定的整数部分延迟;p∈[-0.5, 0.5]为可调参数, 表示可变的分数部分延迟。
通常用Farrow结构来设计实现VFD FIR滤波器。Farrow结构如图1所示。
在这里插入图片描述
图1 Farrow结构
Farrow结构含有M+1个并行连接的N阶FIR滤波器, 系统函数为:
在这里插入图片描述
其中, N为滤波器阶数;p∈[-0.5, 0.5]为可调参数, 表示可变的分数部分延迟。本文选择N=2D, 所以N为偶数。
系数hn § , 0≤n≤N, 表示为p的多项式如下:
在这里插入图片描述
其中, an, m即为图1中各子滤波器系数, 可表示成矩阵形式:
在这里插入图片描述
将式 (3) 代入式 (2) , 系统函数可重新写为:
在这里插入图片描述
其中, 各子滤波器系统函数为:
在这里插入图片描述
因此, H (z, p) 的频率响应为:
在这里插入图片描述
其中, ω∈[-π, π]是归一化的角频率;Am (ω) 是滤波器Am (z) 的频率响应。实际频率响应 (式 (5) ) 和目标频率响应 (式 (1) ) 间的误差为:
在这里插入图片描述
VFD FIR滤波器的设计目标是找到使:
在这里插入图片描述
取得最小值的最优滤波器系数an, m。

二、部分源代码

function varargout = FOD4(varargin)
%FOD4 M-file for FOD4.fig
%      FOD4, by itself, creates a new FOD4 or raises the existing
%      singleton*.
%
%      H = FOD4 returns the handle to a new FOD4 or the handle to
%      the existing singleton*.
%
%      FOD4('Property','Value',...) creates a new FOD4 using the
%      given property value pairs. Unrecognized properties are passed via
%      varargin to FOD4_OpeningFcn.  This calling syntax produces a
%      warning when there is an existing singleton*.
%
%      FOD4('CALLBACK') and FOD4('CALLBACK',hObject,...) call the
%      local function named CALLBACK in FOD4.M with the given input
%      arguments.
%
%      *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 FOD4

% Last Modified by GUIDE v2.5 10-Sep-2021 20:42:09

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @FOD4_OpeningFcn, ...
                   'gui_OutputFcn',  @FOD4_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 FOD4 is made visible.
function FOD4_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   unrecognized PropertyName/PropertyValue pairs from the
%            command line (see VARARGIN)

% Choose default command line output for FOD4
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes FOD4 wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = FOD4_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;






function fsorder_Callback(hObject, eventdata, handles)
% hObject    handle to fsorder (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 fsorder as text
%        str2double(get(hObject,'String')) returns contents of fsorder as a double
fsorder = str2double(get(hObject, 'String'));
if isnan(fsorder)
    set(hObject, 'String', 0);
    errordlg('Input must be a number','Error');
end
% 保持新的FS阶数
handles.metricdata.fsorder =fsorder ;
guidata(hObject,handles)

% --- Executes during object creation, after setting all properties.
function fsorder_CreateFcn(hObject, eventdata, handles)
% hObject    handle to fsorder (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 fodM_Callback(hObject, eventdata, handles)
% hObject    handle to fodM (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 fodM as text
%        str2double(get(hObject,'String')) returns contents of fodM as a double
fodM = str2double(get(hObject, 'String'));
if isnan(fodM)
    set(hObject, 'String', 0);
    errordlg('Input must be a number','Error');
end
% 保持新的FOD阶数M
handles.metricdata.fodM =fodM ;
guidata(hObject,handles)

% --- Executes during object creation, after setting all properties.
function fodM_CreateFcn(hObject, eventdata, handles)
% hObject    handle to fodM (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 fodn_Callback(hObject, eventdata, handles)
% hObject    handle to fodn (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 fodn as text
%        str2double(get(hObject,'String')) returns contents of fodn as a double
fodn = str2double(get(hObject, 'String'));
if isnan(fodn)
    set(hObject, 'String', 0);
    errordlg('Input must be a number','Error');
end
% 保持新的FOD-n数
handles.metricdata.fodn =fodn ;
guidata(hObject,handles)

% --- Executes during object creation, after setting all properties.
function fodn_CreateFcn(hObject, eventdata, handles)
% hObject    handle to fodn (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

三、运行结果

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

四、matlab版本及参考文献

1 matlab版本
2014a

2 参考文献
[1] 沈再阳.精通MATLAB信号处理[M].清华大学出版社,2015.
[2]高宝建,彭进业,王琳,潘建寿.信号与系统——使用MATLAB分析与实现[M].清华大学出版社,2020.
[3]王文光,魏少明,任欣.信号处理与系统分析的MATLAB实现[M].电子工业出版社,2018.
[4]孙冬艳,赵加祥,赵晓明.基于PSO的可变分数延迟滤波器设计[J].计算机工程. 2010,36(18)

猜你喜欢

转载自blog.csdn.net/TIQCmatlab/article/details/120585405