Documentation for iirEuler (SPASS).

Euler scheme for IIR filters


Description

The function iirEuler performs a IIR filtering using the Euler scheme to solve the state equation.

Usage

sig_out = iirEuler(sig_in,fsm)

Arguments

sig_in Input signal. Non Uniform signal.
fsm Filter state matrix. Filter state matrix.

Values

sig_out Filtered output signal. Non Uniform signal.

See Also

Example

% Creation of a non 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 .4 .7 1.1 1.4 1.7];
nu = levelcross(u,levels);

% Creation of a uniform filter

fc = 2;          % cut frequency
order = 10;      % filter order  
wc = 2*pi*fc;    % cut pulsation

[A,B,C,D] = butter(order,wc,'s');
fsm = fsminit(A,B,C,D);

% FIR filtering

sig = iirEuler(nu,fsm);

% Plot result

figure(1)
plot(delay2time(nu.delay,nu.t0),nu.ampl,'k');
hold on
plot(delay2time(sig.delay,sig.t0),sig.ampl,'r');
hold off