# Matlab filter design,through group delay

I have the measurements of a filter’s Group delay and S-parameters. The S-parameters are of the following form, presented in a touchstone file.

!Agilent Technologies,N5242A,MY49421489,A.09.33.09
!Agilent N5242A: A.09.33.09
Date: Thursday, March 22, 2012 19:50:06
!Correction: S11(Full 2 Port(1,2))
!S21(Full 2 Port(1,2))
!S12(Full 2 Port(1,2))
!S22(Full 2 Port(1,2))
!S2P File: Measurements: S11, S21, S12, S22: Hz S dB R 50
1450000000 -0.44925556 132.79056 -43.664959 42.970737 -43.609634 45.291161 -0.41757283 131.60133

The filter’s Group delay data are like those demonstrated below:

!CSV A.01.01 !Date: Thursday March 22
!Source: Standard
BEGIN CH1_DATA
Freq(Hz) S21 Delay(s)
1.45E+09 -2.02E-08
1.45E+09 -1.32E-08
1.45E+09 -1.77E-08
1.45E+09 -1.70E-08
1.45E+09 -1.56E-08
1.45E+09 -1.36E-08
1.45E+09 -1.20E-08

What I want to do is simulate the impact that the group delay will have on a particular waveform using MATLAB. I tried to use the fdesign.arbgrpdelay in order to insert my group delay data and somehow observe how that would impact on a waveform but I am getting the following errors:

Error using fdesign.abstracttype/superdesign (line 96) Design options must be specified as a structure or as parameter-value pairs.

Error in fdesign.abstracttype/design (line 11) varargout{1} = superdesign(this, varargin{:});

Error in allpassfilterarbitrarygrpdly (line 413) Hgd = design(hgd,'iirlpnorm','Weights','MaxPoleRadius',0.95);

I also tried to use fdatool but I couldn't find a way of designing a filter by changing its group delay. The group delay was flat in all the available designs.

Does anyone knows how I can use the Group delay measurements in matlab to simulate a filter through its group delay?

• Your question seems unclear. What exactly are you trying to measure? Do you have group delays of the filter with respect to frequency of the signal? – Hephaestus Sep 1 '12 at 22:01
• Exactly,I have the group delays in respect with frequency(as they are illustrated in the two columns Freq(Hz) S21 Delay(s)).I want to see the impact that they have in a waveform after this waveform been filtered by a filter having that group delay response. – Rizias Sep 1 '12 at 23:07

## 2 Answers

The Solution finally was to match the input vectors in the group delay simulating Matlab functions.That means that the frequencies and the group delay Vectors given as input in Matlab should be SHORT and not as long as i had to give,and exactly on the same length (which makes sense).The most tricky part is to find which length was that would fit in and run the simulation.

• Can you add the code in your answer that solves the problem? – Naveen May 9 '15 at 19:30
• That was some years ago,I dont know even if i have the code. – Rizias May 11 '15 at 9:15
• Can you give this answer the check mark? Just trying to get more old questions to have accepted answers! :-) – Peter K. Dec 5 '15 at 3:23

Have a look at fdesign.arbgrpdelay.

The example there is:

Create an arbitrary group delay filter that delays the higher–frequency wave packet by approximately 100 samples.

And they give the code:

N = 18;
f = 0:.1:1;
gd = ones(size(f));
% Delay pi/2 radians/sample by 100 samples
gd(6) = 100;
d = fdesign.arbgrpdelay(N,f,gd);
Hd = design(d,'iirlpnorm','MaxPoleRadius',0.9);
% Visualize the group delay
fvtool(Hd,'analysis','grpdelay');