WienerHammersteinIdent

WienerHammersteinIdent - % Wiener - Hammerstein...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
%% Wiener - Hammerstein Identification (by convolution and small signal %% analysis ) clear all b1 = [1 .8 .3]; ic =i; a1 = poly([.78*exp(ic) .78*exp(-ic) .88*exp(1.6*ic) .88*exp(-1.6*ic)]); a2 = poly([.98*exp(2*ic) .98*exp(-2*ic) .96*exp(3.6*ic) .96*exp(-3.6*ic)]); b2 = [1 .6 .4]; a = (poly([roots(a1)' roots(a2)']))',b = (poly([roots(b1)' roots(b2)']))' u = .2*normrnd(0,2,1,700);%u_st = ones(1,700); %e = .2*normrnd(0,.012,1,1265); e = zeros(1,1265); [h1,tt1] = impz(b1,a1); [h2,tt2] = impz(b2,a2); v = conv(h1,u); % output of 1st filter w = 5*(-.5 + 1./(1 + exp(-.5*v)) );% 2*v;% (sin(v).*v)+4*v;% output of nonlinearity y = conv(h2,w)+e; %output of 2nd filter. 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 nonlinearity'); subplot(4,1,3) ; plot(w(1:700)); title('output of the nonlinearity'); subplot(4,1,4) ; plot(y(1:700));title('output of the whole system'); N=200; r=9; m=4;n= sum(size([a1 a2]))-3; sg = 1/sqrt(2); %% solve linear equation % construct Kernel matrix . The last two hundred data points will be used. xtrain = u(201:200+N); for i=1:N % K is omega matrix for j=1:N K(i,j) = exp(-((u(1,i+200)-u(1,j+200))^2)/(2*sg^2)); %itis oki end end % 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. for i=1:n Yp(i,1:N-r+1) = y(1,200+r-i:N+200-i); %itis okei end % 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); end Ko(p,q) = sumk; end end % Construct Ksus . Ksus:194*194 (expected, not sure): well Ksus2 = Ksus . % it is great. for p = 1:N-r+1 for q = 1:N-r+1 sumks = 0; for j =0:m % 0 dan 3 e olmas? gerekti?i tespit edilmi?ti. sumks = sumks + K(p+r-j-1,q+r+j-1); end Ksus2(p,q) = sumks; end end Ksus = zeros(N-r+1); ud =u(1,201:200+N)'; yd =y(1,201:200+N); %it is okei
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
for j=0:m Ksus = Ksus + kernel_matrix(ud(r-j:N-j),'RBF_kernel',2*sg^2); end; %% Construct the linear equation matrix (205 by 205) and solve the equation gm = 500; bigEqMat = [0 zeros(1,n) ones(1,N-r-1) zeros(1,m+1);. .. zeros(n,1) zeros(n,n) Yp zeros(n,m+1);. .. ones(N-r+1,1) Yp' Ksus+(1/gm)*eye(N-r+1,N-r+1) Ko;. .. zeros(m+1,1) zeros(m+1,n) Ko' ones(1,N)*K*ones(N,1)*eye(m+1,m+1)]; rightSide = [0 zeros(1,n) Yf zeros(1,m+1) ]'; finSolution = bigEqMat\rightSide; % partition the finSolution. d = finSolution(1,1)
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

WienerHammersteinIdent - % Wiener - Hammerstein...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online