16 November 2009

fuzzy logic 2

Now we create three output matrixs

cnt = 1


for x=1:100



if x>=50

little(cnt,1:2)=[x, 0];

else if x>=0&&x<=25

little(cnt,1:2)=[x ,1];

else if x>=25&&x<=50

little(cnt,1:2)=[x, -0.04*x+2];

end

end

end

cnt=cnt+1

end



mnt =1

for y=1:100



if y>=50&&y<=75

some (mnt,1:2)=[y, -0.04*y+3];

else if y>=0&&y<=25

some(mnt,1:2)=[y ,0];

else if y>=25&&y<=50

some(mnt,1:2)=[y, 0.04*y-1];

else if y>75

some (mnt,1:2)=[y, 0];

end

end

end

end



mnt=mnt+1

end



bnt=1

for z=1:100

if z<=50

max(bnt,1:2)=[z 0];

else if z>=50&&z<=75

max(bnt,1:2)=[z, 0.04*z-2]

else if z>=75

max(bnt,1:2)=[z 1]

end

end

end

bnt=bnt+1

end





plot(little(:,1),little(:,2))

hold on



plot(some(:,1),some(:,2))

hold on

plot(max(:,1),max(:,2))
 
The figure is the same as input:


We gave the real input speed i.e50


To build a combine output matrix

max them


Create a ultimate result





Then you can use command "min","max" or "mean" to get the result that the system want to be .

No comments:

Post a Comment

photo

photo