% Nonlinear filter of L1=4, L2=3.
% y(n) = x(n) - x(n-1) - .125x(n-2) + .3125x(n-3)
% +x(n)x(n) -.3x(n)x(n-1) + .2x(n)x(n-2)
% +.5x(n-1)x(n-1) -.3x(n-1)x(n-2)
% -.6x(n-2)x(n-2)
h = [1;-1;-0.125;0.3125;1;-0.3;0.2;0.5;-0.3;-0.6];
% input signal is a one second sinusoidal of 100 Hz
% sampled at 1000 Hz.
t = (1:1000)/1000;
x = cos(2*pi*100*t);
y = sovfilt(h,x,4,3);
subplot(2,2,1); plot(abs(fft(x)));
subplot(2,2,2); plot(abs(fft(y)));
Running the above script will produce the graph shown in Fig. 9.10.
Note that although the input signal has only one frequency component at 100 Hz,
the filter output has three components at 0, 100, and 200 Hz. This is a general
characteristic of nonlinear filters.
|