Documentation for `levelcross` (SPASS).

Level crossing scheme for a real signal

Description

The function `levelcross` computes a non uniform signal from a uniform or non uniform signal via a level crossing scheme. Contrarily to the Asynchronous Analog to Digital Conversion, the output samples are not samples from the initial signal but linearly interpolated samples.

Usage

```nu = levelcross(sig,levels)
```

Arguments

 `sig` Uniform signal or Non Uniform signal. `levels` Set of levels. Row or column vector.

Values

 `nu` Non Uniform signal.

• aadc (Asynchronous Analog to Digital Conversion)

Examples

```% Creation of a uniform signal

f = 1;           % signal frequency
t = 10/f;        % signal duration
fs = 1000;       % sampling frequency
ts = 1/fs;       % sampling time
t0 = 1.;         % initial time
times = t0+(0:ts:t); % time samples
a = 0.45;        % signal amplitude

ampl = a*sin(2*pi*f*times)+a*sin(4*2*pi*f*times)+0.9;   % amplitudes

u = uinit(ampl,ts,t0);

% Level crossing

levels = [.1 .8 1.3];
nu = levelcross(u,levels);

% Plot result

figure(1)
plot(times,ampl,'k','LineWidth',1)
hold on
plot(delay2time(nu.delay,nu.t0),nu.ampl,'r*')
hold off
```
```% Creation of a non uniform signal

f = 1;           % signal frequency
t = 10/f;        % signal duration
t0 = 1.;         % initial time
nbsamples = 10;  % number of samples
times = t0+t*random('unif',0,1,1,nbsamples);
times=sort(times); % time samples
delay=time2delay(times,t0); % delay samples
a = 0.45;        % signal amplitude

ampl = a*sin(2*pi*f*times)+a*sin(4*2*pi*f*times)+0.9;   % amplitudes

nu = nuinit(ampl,delay,t0);

% Level crossing

levels = [.1 .8 1.3];
nu = levelcross(nu,levels);

% Plot result

figure(2)
plot(times,ampl,'k','LineWidth',1)
hold on
plot(delay2time(nu.delay,nu.t0),nu.ampl,'r*')
hold off
```