Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Profesor
Uvod
MATLAB...
Fuzzy
Elektrotehniki fakult
newfis :
addvar :
addmf :
addrule :
plotfis :
evalfis :
setfis :
plotmf :
Elektrotehniki fakult
Elektrotehniki fakult
Elektrotehniki fakult
Elektrotehniki fakult
Elektrotehniki fakult
Elektrotehniki fakult
Elektrotehniki fakult
Elektrotehniki fakult
10
Elektrotehniki fakult
11
Elektrotehniki fakult
12
Elektrotehniki fakult
13
Elektrotehniki fakult
14
Elektrotehniki fakult
15
Elektrotehniki fakult
16
Elektrotehniki fakult
17
Elektrotehniki fakult
18
Elektrotehniki fakult
19
Elektrotehniki fakult
20
Elektrotehniki fakult
21
Elektrotehniki fakult
22
Elektrotehniki fakult
23
Elektrotehniki fakult
24
Elektrotehniki fakult
25
y ( k 1) a (Ts ) y (k )
Gde je:
= 1.00151*10-4
= 8.67973*10-3
gama = 40
Y0 = 25C
b(Ts )
u (k ) [1 a (Ts )]Y 0,
1 e 0.5 y ( k )
a (Ts ) e Ts
b(Ts ) ( )(1 e Ts )
Elektrotehniki fakult
26
Period uzorkovanja:
0V u(k) 5V
Ts = 25s (sekundi)
Fuzzy kontroler treba da kontrolie temperaturu vode u kadi tako da ona prati referentnu konturu
(signal), iji je oblik definisan na sledei nain:
35C , 0 t 40 minuta
50C , 40 t 80 minuta
65C , 80 t 120 minuta
80C , 120 t 180 minuta
Elektrotehniki fakult
27
1.
e(t) - Izvrna greka (predstavlja razliku izmeu eljene temperature vode i stvarne izmerene
temperature);
2.
1.
Za svaku varijablu je definisano po 7 Gausovih funkcija pripadnosti, ija su imena: NL, NM, NS,
ZE, PS, PM ,PL;
Elektrotehniki fakult
28
Elektrotehniki fakult
29
Elektrotehniki fakult
30
Elektrotehniki fakult
31
Test program
end;
cee(k)=ce(k)*GC;
mu(k)=evalfis([ee(k) cee(k)],fis);
u(k)=mu(k)*GU;
if (u(k)>=5) u(k)=5;
elseif (u(k)<=0) u(k)=0;
else u(k)=u(k);
end;
y(k + 1)=a*y(k)+b/(1+exp(0.5*y(k)-r))*u(k)+(1a)*yo;
end;
hold on; grid; % Plot plant input/output and
reference output.
plot(y(1:180), '.y'); plot(ref(1:180),'--r');
plot(u(1:179),'g');
xlabel('Sampling Time Step kT T = 25 seconds');
ylabel('Temperature(degree)');
title('Reference Signal "- -" Actual Output "."
Control Signal "---"');
pause % Hit any key to calculate the
performance index AES.
AES=sum(abs(ref-y));
Elektrotehniki fakult
32
Elektrotehniki fakult
33
Rezultati simulacije
AES k 1| ref (k ) y (k ) |
Elektrotehniki fakult
34
Elektrotehniki fakult
35
Elektrotehniki fakult
36
Elektrotehniki fakult
37
Elektrotehniki fakult
38
Elektrotehniki fakult
39
y ( x) e
x
2
cos(2 x)
Na intervalu:
x [0,3]
Elektrotehniki fakult
40
Elektrotehniki fakult
41
PR
R x 2 matrica minimalnih i maksimalnih vrednosti za R ulaza;
Si
Veliina i-tog sloja, za Nl slojeva;
TFi
Transfer funkcija i-tog sloja (default = 'tansig'). (logsig, purelin);
BTF Backpropagation network training function (default = 'trainlm').(trainbfg, trainrp,
traingd);
BLF Backpropagation weight/bias learning function (default = 'learngdm'). (learngd);
PF
Performance function (default = 'mse'). (msereg);
Elektrotehniki fakult
42
Elektrotehniki fakult
43
Elektrotehniki fakult
44
Elektrotehniki fakult
45
Elektrotehniki fakult
46
Elektrotehniki fakult
47
Elektrotehniki fakult
48
Elektrotehniki fakult
49
Elektrotehniki fakult
50
Elektrotehniki fakult
51
x=0:0.01:3;
y=exp(-0.5*x).*cos(2*x);
yn=y+randn(size(y))*0.08;
net=newff([0 3],[2 1],{'tansig', 'purelin'});
net.trainParam.epochs=25;
net.trainParam.goal=0.000001;
[net,tr]=train(net,x,yn);
err=min(tr.perf);
for i=1:100
net1=newff([0 3],[2 1],{'tansig','purelin'});
net1.trainParam.epochs=25;
net1.trainParam.goal=0.000001;
[net1,tr1]=train(net1,x,yn);
err1=min(tr1.perf);
if err1<err
net=net1;
err=err1;
end
end
net.trainParam.epochs=2000;
net.trainParam.goal=0.000001;
[net,tr]=train(net,x,yn);
Elektrotehniki fakult
52
Na intervalu:
x [9,19]
Elektrotehniki fakult
53
Elektrotehniki fakult
54
Elektrotehniki fakult
55
Elektrotehniki fakult
56
Elektrotehniki fakult
57
Elektrotehniki fakult
58
Elektrotehniki fakult
59
Elektrotehniki fakult
60
Elektrotehniki fakult
61
Elektrotehniki fakult
62
Elektrotehniki fakult
63