%% Wiener identification : thinking it as a Hammerstein model. Using small
%% signal analysis. a filter and a gain is obtained. than the svm is
%% trained to model the overall nonlineah svm.
% Then we will construct a closed loop system where at the feedback the
% inverse model of the nonlinearity is present. And we may add a controller
% such that the control design spesifications are satisfied.
u=.25*normrnd(0,2,1,700) ; %.1111;
% A white gaussian input sequence u with
%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(1.*ic) .98*exp(-1.*ic) .98*exp(1.6*ic) .98*exp(-1.6*ic) .
b = [1 -.7 .5 -.4] ;
% bi s
% the roots below will be used for the closed loop system below. A
% controller is added to the roots: rts.
rts_c = [1 .98*exp(ic) .98*exp(-ic) .98*exp(1.6*ic) .98*exp(-1.6*ic) .
% now we will get the input output data of the original Wiener system
% ,small signals are used.
[h,tt] = impz(b,[a]);
%filter impulse response
us = [0 u(1:end-1)];
% past values of "u"
v = conv(h,u);
v2 = .25*u; y2 = conv(h,v2);
y = 3*(-.5 + 1./(1 + exp(-.5*v)) ) +e;%
figure(1);subplot(4,1,1) ; plot(u(1:700)); title('input to the system');
subplot(4,1,2) ; plot(v(1:700)); title('output of the filter: before
subplot(4,1,3) ; plot(y(1:700)); title('output of the whole system');hold off
subplot(4,1,4) ; plot(y2(1:700));title('output of the whole system;v2 = .25*u
m=3;n= sum(size(a))-2; sg = 1;
solve linear equation
% construct Kernel matrix . The last two hundred data points will be used.
xtrain = u(201:400);
% K is omega matrix
K(i,j) = exp(-((u(1,i+200)-u(1,j+200))^2)*1);
% Construct Yf. Again the last two hundred data points will be used .
Yf = y(1,200+r:200+N);
%it is okei
% Construct Yp:n*N-r+1.
Again the last two hundred data points will be used.
Yp(i,1:N-r+1) = y(1,200+r-i:N+200-i);
% Construct Ko. Ko:194*4 (expected) it is okei.
for p = 1:N-r+1
for q = 1:m+1
sumk = 0;
for t = 1:N
sumk = sumk + K(t,r+p-q);
Ko(p,q) = sumk;