필터 지우기
필터 지우기

Why do signals differ in fdesign.fracdelay and dsp.Variab​leFraction​alDelay?

조회 수: 5 (최근 30일)
Mikhail Yurkov
Mikhail Yurkov 2018년 11월 29일
댓글: Mikhail Yurkov 2018년 11월 29일
Hello!
I use two Matlab functions that implement the 3rd order Farrow filter (fdesign.fracdelay and dsp.VariableFractionalDelay).
These functions give different results.
Below is a code and a graph of the absolute value of the difference of the signals at the outputs of the filters.
Why does an error occur if the coefficient must be the same?
close all;
clearvars;
clc;
%% Parameters
% Signal
fs = 2000; % Sampling frequency
t = (0 : 1/fs : 2 - 1/fs).'; % Time
s = chirp(t-2, 4, 1/2, 6, 'quadratic', 100, 'convex').*exp(-4*(t-1).^2); % Signal
% Delay
d = 0.9;
%% FFT-delay
s_d = delayseq(s, d);
%% Farrow filter 3-rd order
fd = fdesign.fracdelay(d, 'N', 3);
cubicfarrow = design(fd, 'lagrange', 'FilterStructure', 'farrowfd');
y_farrow = filter(cubicfarrow, s);
%% Variable Fractional Delay
vfd = dsp.VariableFractionalDelay('InterpolationMethod', 'Farrow');
y_vfd = vfd(s, d);
%% Error
Err = abs(y_farrow - y_vfd);
Err_farrow = abs(s_d - y_farrow);
Err_vfd = abs(s_d - y_vfd);
%% Pots
hSig = figure ('Units', 'Normalized', ...
'Position', [0.1, 0.1, 0.8, 0.8], ...
'PaperOrientation', 'landscape', ...
'NumberTitle', 'off', ...
'Name', 'Signal', ...
'Tag', 'Fig_Sig');
movegui(hSig, 'center');
hold on;
ps = plot(t, s, 'Color', 'Red', 'LineWidth', 3);
psd = plot(t, s_d, 'Color', 'Black', 'LineWidth', 3);
psfarrow = plot(t, y_farrow, 'Color', 'Blue', 'LineWidth', 2);
psvfd = plot(t, y_vfd, 'Color', 'Magenta', 'LineWidth', 2);
hold off;
grid on;
legend([ps, psd, psfarrow, psvfd], 'Signal', 'FFT', 'fractdelay', 'VariableFractionalDelay');
hErr = figure ('Units', 'Normalized', ...
'Position', [0.1, 0.1, 0.8, 0.8], ...
'PaperOrientation', 'landscape', ...
'NumberTitle', 'off', ...
'Name', 'Errors', ...
'Tag', 'Fig_Err');
movegui(hSig, 'center');
hold on;
pe = plot(t, Err, 'Color', 'Red', 'LineWidth', 3);
pefarrow = plot(t, Err_farrow, 'Color', 'Blue', 'LineWidth', 2);
pevfd = plot(t, Err_vfd, 'Color', 'Magenta', 'LineWidth', 2);
hold off;
grid on;
legend([pe, pefarrow, pevfd], '|farrow - vfd|', 'fractdelay', 'VariableFractionalDelay');
Err.png

답변 (1개)

Honglei Chen
Honglei Chen 2018년 11월 29일
Your dsp.VariableFractionalDelay is actually order 4. If you do
vfd = dsp.VariableFractionalDelay('InterpolationMethod', 'Farrow', 'FilterLength', 3);
The result of vfd and cubicfarrow will match.
HTH
  댓글 수: 1
Mikhail Yurkov
Mikhail Yurkov 2018년 11월 29일
Hello! Thanks for your reply.
But if I do
fdesign.fracdelay(d, 'N', 4);
vfd = dsp.VariableFractionalDelay('InterpolationMethod', 'Farrow', 'FilterLength', 4);
The result of vfd and cubicfarrow will not match.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Signal Operations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by