# matchingloss

## Syntax

``Lm = matchingloss(S,H)``

## Description

example

````Lm = matchingloss(S,H)` calculates the receiver filter loss, `Lm`, in dB. The receiver loss is introduced due to a mismatch between the spectrum of the received signal, `S`, and the frequency response of the mismatched filter, `H`.```

## Examples

collapse all

Compute the matching loss for a rectangular pulse and a mismatched second-order Butterworth filter.

Define sampling frequency, pulsewidth, and filter bandwidth.

```Fs = 10; % Sampling frequency (Hz) tau = 1.2; % Pulsewidth (s) B = 1.0; % Filter bandwidth (Hz)```

Calculate the rectangular pulse in the time domain.

`s = ones(1,Fs*tau);`

Calculate the spectrum of the received pulse.

```nfft = 2^(nextpow2(tau*Fs)+1); S = fft(s,nfft);```

Calculate the frequency response of a second-order Butterworth filter with bandwidth `B`.

```[b,a] = butter(2,B/Fs); [H,w] = freqz(b,a,nfft,'whole',Fs);```

Compute the matching loss for the pulsewidth-bandwidth product, `tau*B` = 1.2.

`Lm = matchingloss(S,H.')`
```Lm = 0.9806 ```

## Input Arguments

collapse all

Spectrum of the received signal, specified as a J-by-N matrix with rows corresponding to spectra of J signals and columns corresponding to N frequency bins.

Frequency response of the mismatch filter, specified as a K-by-N matrix with rows corresponding to frequency responses of `K` filters and columns corresponding to N frequency bins.

Note

The columns of `S` and `H` must correspond to the same N frequency bins.

## Output Arguments

collapse all

Matching loss, returned as a J-by-K matrix in dB. The matching loss matrix is computed for each combination of J signals and K filters.

## Extended Capabilities

### C/C++ Code GenerationGenerate C and C++ code using MATLAB® Coder™. 