Calculate group delay out of phase response - Usage of FIR differentiator ?
    7 views (last 30 days)
  
       Show older comments
    
I would like to show a bode plot and the corresponding group delay for some filter application. 
I've got a simulink model of my filter. I use band-limited white noise as the input signal and record the output signal of my filter. 
To create an simple example I am just using the transfer function of my filter to show the principle problem.
% Create binomial filter of order N=100
N=100;z = tf('z', Thf)
filte_HF=(2^(-N)*(1-z^(-1))^(N));
% Show bode plot in Hz
options=bodeoptions;
options.FreqUnits = 'Hz';
% Create frequenc vector
delta_f = 1e-1;
f = 1:delta_f:2000;
w=2*pi*f;
% Calculate bode diagram
[mag,phase,w]=bode(filte_HF, options,w);
phi=squeeze(phase);
% Plot Bode diagram
 figure(1);
 bode(filte_HF,options);grid on;hold on;
% Calculate group delay using Matlab function
[gd,wgrp]=grpdelay(cell2mat(filte_HF.Numerator),cell2mat(filte_HF.Denominator),f,1/Thf);
% Compare group delay of Matlab function and manually calcuated group delay
% out of the phase response
figure(2);
semilogx(f,gd*Thf);hold on;
semilogx(f(1:end-1),-diff(deg2rad(phi))./diff(w),'--');
% semilogx(f,filter(Hd,-deg2rad(phi)));
ylim([0 50e-3]);
Questions:
1) Why is the result of the matlab function grpdelay different from the manually calculated groupdelay with -diff(deg2rad(phi))./diff(w)?
2) I want to use the original noisy signals from my simulink model. I use tfestimate to get the transfer function estimate and then angle(txy). I get a phase reponse which is also a little more noisy. Out of this I also want to calculate the group delay that means the derivative of the phase reponse. To cope with that problem I found that a differentiator  filter could be used. Example:
My problem is how to design the filter if I don't want to differentiate a time-based signal, but a frequency-based signal, which is the phase response? How to chose the passband and stopband frequency and sample frequency?
Nf = 50; 
Fpass = ??; 
Fstop = ??;
Fs=??
Hd = designfilt('differentiatorfir','FilterOrder',Nf, ...
    'PassbandFrequency',Fpass,'StopbandFrequency',Fstop, ...
    'SampleRate',Fs);
3) Are there other options to solve that problem?
3 Comments
Answers (0)
See Also
Categories
				Find more on Get Started with DSP System Toolbox 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!

