# log

Natural logarithm of scattering transform

## Syntax

``slog = log(sf,s)``
``ulog = log(sf,u)``
``xlog = log(sf,x)``

## Description

````slog = log(sf,s)` returns the natural logarithm of the scattering coefficients in the cell array `s`. `s` is the output of `scatteringTransform` and is a cell array of structure arrays with a `signals` field.The precision of `slog` depends on the precision specified in the wavelet time scattering network `sf`.```
````ulog = log(sf,u)` returns the natural logarithm of the scalogram coefficients in the cell array `u`. `u` is the output of `scatteringTransform` and is a cell array of structure arrays with a `coefficients` field.The precision of `ulog` depends on the precision specified in the wavelet time scattering network `sf`.```

example

````xlog = log(sf,x)` returns the natural logarithm of the 2-D matrix or 3-D array `x`. `x` is the output of `featureMatrix`.The precision of `xlog` depends on the precision specified in the wavelet time scattering network `sf`.```

## Examples

collapse all

This example shows how to obtain the natural logarithm of scattering coefficients.

Load a noisy Doppler signal and create a wavelet time scattering network that can be used with the signal. Return the scattering coefficients.

```load noisdopp sf = waveletScattering('SignalLength',numel(noisdopp)); S = scatteringTransform(sf,noisdopp);```

Calculate the natural logarithm of the scattering coefficients. Display the number of rows in the table containing the first-order scattering coefficients.

```slog = log(sf,S); coefOrder = 1; display(['Number of rows: ',... num2str(size(S{coefOrder+1},1))])```
```Number of rows: 41 ```

Choose a row from the first-order scattering coefficients table. Take the natural logarithm of the absolute value of the scattering coefficients in that row. Compare with the corresponding row in `slog` and confirm they are equal.

```row = 23; tmp1 = slog{coefOrder+1}.signals{row}; tmp2 = log(abs(S{coefOrder+1}.signals{row})); disp(['Max Difference of Scattering Coefficients: ',... num2str(max(abs(tmp1(:)-tmp2(:))))])```
```Max Difference of Scattering Coefficients: 0 ```

## Input Arguments

collapse all

Wavelet time scattering network, specified as a `waveletScattering` object.

Scattering coefficients, specified as a cell array of structure arrays. `s` is the output of `scatteringTransform` for the scattering network `sf`.

Scalogram coefficients, specified as a cell array of structure arrays. `u` is the output of `scatteringTransform` for the scattering network `sf`.

Scattering feature matrix, specified as a real-valued 2-D matrix or 3-D array. `x` is the output of `featureMatrix` for the scattering network `sf`.

## Output Arguments

collapse all

Natural logarithm of scattering coefficients, returned as a cell array. The dimensions of `slog` are equal to the dimensions of `s`.

The precision of `slog` depends on the precision specified in the scattering network `sf`.

Natural logarithm of scalogram coefficients, returned as a cell array. The dimensions of `ulog` are equal to the dimensions of `u`.

The precision of `ulog` depends on the precision specified in the scattering network `sf`.

Natural logarithm of scattering feature matrix, returned as a real-valued matrix or array. The dimensions of `xlog` are equal to the dimensions of `x`.

The precision of `xlog` depends on the precision specified in the scattering network `sf`.

## Algorithms

`log` returns the natural logarithm of the absolute value of the input argument.

## Version History

Introduced in R2018b