A First Course in FUZZY and NEURAL CONTROL

(singke) #1
222 CHAPTER 6. NEURAL CONTROL

Figure 6.23. Plant and trained neural network
response to the same random input
At this stage, as shown in Figure 6.23, we have a trained neural network
that we hope will perform well when normally occurring input data is applied
to it. If the same input applied to the plant is applied to the neural network,
and both produce the same output, then we have identified the plant behavior
and obtained a model of the plant. The next step therefore involves setting
up the input that would be normally applied to the plant and to simulate the
behavior of both the plant and the corresponding trained neural network.


Step 11. Generate a vector of input data and simulate both the original plant
response and the trained neural network. The followingMatlabcode generates
aspecified inputu(k)and simulates the behavior of the nonlinear system and
of the trained neural network.


yp(1)=0.0; yp(2)=0.0;out1(1)=0; out1(2)=0;
for k=2:500
if (k<=200)u(k)=2.0*cos(2*pi*k*0.01);
else
u(k)=1.2*sin(2*pi*k*0.05);
end;
yp(k+1)=yp(k)*(yp(k-1)+2)*(yp(k)+2.5)/(8.5+yp(k)^2
+yp(k-1)^2)+u(k);
out1(k)=yp(k)/20;
out1(k-1)=yp(k-1)/20;
nnout(k+1)=20*sim(net,[out1(k);out1(k-1)])+u(k);
end;
plot(yp, íbí);
hold on;
plot(nnout, í:kí);
grid;
axis([0, 500, -4.0, 10.0]);
Free download pdf