# lagrange

Fractional delay filter from `fdesign.fracdelay` specification object

## Syntax

```Hd = design(d,'lagrange') hd = design(d,'lagrange',FilterStructure,structure) ```

## Description

`Hd = design(d,'lagrange')` designs a fractional delay filter using the Lagrange method based on the specifications in `d`.

`hd = design(d,'lagrange',FilterStructure,structure)` specifies the Lagrange design method and the `structure` filter structure for `hd`. The only valid filter structure is `fd`, describing the fractional delay structure.

## Examples

This example uses a fractional delay of 0.30 samples. The `help` and `designopts` commands provide the details about designing fractional delay filters.

```d=fdesign.fracdelay(.30) d = Response: 'Fractional Delay' Specification: 'N' Description: {'Filter Order'} FracDelay: 0.3 NormalizedFrequency: true FilterOrder: 3 designmethods(d) Design Methods for class fdesign.fracdelay (N): lagrange help(d,'lagrange') DESIGN Design a Lagrange fractional delay filter. HD = DESIGN(D, 'lagrange') designs a Lagrange filter specified by the FDESIGN object D, and returns the DFILT object HD. HD = DESIGN(..., 'FilterStructure', STRUCTURE) returns a filter with the structure STRUCTURE. STRUCTURE is 'farrowfd' by default and can be any of the following: 'farrowfd' 'fd' % Example #1 - Design a linear Lagrange fractional delay filter of 0.2 samples. h = fdesign.fracdelay(0.2,'N',2); Hd = design(h, 'lagrange', 'FilterStructure', 'farrowfd') % Example #2 - Design a cubic Lagrange fractional delay filter Fs = 8000; % Sampling frequency of 8kHz fdelay = 50e-6; % Fractional delay of 50 microseconds. h = fdesign.fracdelay(fdelay,'N',3,Fs); Hd = design(h, 'lagrange', 'FilterStructure', 'farrowfd');```

This example designs a linear Lagrange fractional delay filter where you set the delay to 0.2 seconds and the filter order `N` to 2.

```h = fdesign.fracdelay(0.2,'N',2); hd = design(h,'lagrange','FilterStructure','farrowfd')```

Design a cubic Lagrange fractional delay filter with filter order equal to 3.

```Fs = 8000; % Sampling frequency of 8 kHz. fdelay = 50e-6; % Fractional delay of 50 microseconds. h = fdesign.fracdelay(fdelay,'N',3,Fs); hd = design(h,'lagrange','FilterStructure','farrowfd');```

## References

Laakso, T. I., V. Välimäki, M. Karjalainen, and Unto K. Laine, “Splitting the Unit Delay - Tools for Fractional Delay Filter Design,” IEEE® Signal Processing Magazine, Vol. 13, No. 1, pp. 30-60, January 1996.