problem with fdesign.fracdelay
1 view (last 30 days)
Show older comments
Hi,
I have a 50Hz sinusoidal signal - call this as expected signal (Ir).
I have another signal, same as above but shifted by 5 degree - call this as corrupted signal (Ir_Err).
What I want to do is that, I apply fracdelay filter to the corrupted signal in order to obtain expected signal from the corrupted one (Ir_Filtered).
I used the below code in the simplest form. But what I get is same as corrupted signal after removing group delay of fracdelay filter.
fs = 976; % sample frequency in Hz
f = 50; % line frequency in Hz
sim_time = 0.05; % in sec
CT_PHASE_ERROR = 5; % in degree
n = 0:(sim_time*fs)-1;
Ir = sin(2*pi*f*n/fs); % expected signal
Ir_Err = sin(2*pi*f*n/fs + deg2rad(CT_PHASE_ERROR)); % phase shifted signal to be compansated
delay = (CT_PHASE_ERROR/360)/f; % Fractional Delay to be compensated in sec
filter_order = 6; % Order
h = fdesign.fracdelay(delay, 'N', filter_order, fs);
Hd = design(h, 'lagrange', 'filterstructure', 'farrowfd');
Ir_Filtered = circshift(filter(Hd, Ir_Err), [0 -3]); % remove group delay of fracdelay filter
plot(n, Ir,...
n, Ir_Err,...
n, Ir_Filtered);
legend('Ir Expected', 'Ir Err', 'Ir Filtered');
Below plot, blue and yellow lines should match but instead yellow overlaps with the red.
0 Comments
Answers (0)
See Also
Categories
Find more on Single-Rate Filters in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!