%% Wiener identification : thinking it as a Hammerstein model. Using small
%% signal analysis. here a stepwise constant is added to input. But the
%% results seem to be nice for d
%% transient time. Increasing the training data gave worse results.
%% Decreasing it below some points also gave worse results.
u=.35*normrnd(0,.32,1,700) + 24;
% A white gaussian input sequence u with length
%700 0 mean and standard deviation 2
A white gaussian with zero mean and standart de
% viation .2 with length 700. it is error term
%e = zeros(1,1189);
this is added after all. actually it should have
ic = i;
% been done before
rts = [.98*exp(ic) .98*exp(-ic) .98*exp(1.6*ic) .98*exp(-1.6*ic).
% ai s
b = [1 .8 .3 .4] ;
% bi s
% now we will get the input output data.
[h,tt] = impz(b,[a]);
%filter impulse response
us = [0 u(1:end-1)];
% past values of "u"
v = conv(h,u);
v2 = (sin(u).*u) ; y2 = conv(h,v2);figure(50);
plot(u,v2,'r+');title('v2 vs u . hammersteinish ');
% y = conv(h,v2); %
3*(-.5 + 1./(1 + exp(-.5*v)));%2*v;
y_y2diff = y-y2;figure(51);subplot(4,1,4); plot(y_y2diff(1:700));
title('y-y2: wiener output-hammerstein output')
figure(1);subplot(3,1,1) ; plot(u(1:700)); title('input to the system');
subplot(3,1,2) ; plot(v(1:700));
title('output of the filter of wiener: before nonlinearity: v');
axis([1 700 -2 12])
subplot(3,1,3) ; plot(y(1:700));
title('output of the whole system of wiener');hold off