> fis= newfis('tipper')
> fis= addvar(fis, 'input', 'service', c(0,10))
> fis= addvar(fis, 'input', 'food', c(0,10))
> fis= addvar(fis, 'output', 'tip', c(0,30))
> fis= addmf(fis, 'input', 1, 'poor', 'gaussmf', c(1.5,0))
> fis= addmf(fis, 'input', 1, 'good', 'gaussmf', c(1.5,5))
> fis= addmf(fis, 'input', 1, 'excellent', 'gaussmf', c(1.5,10))
> fis= addmf(fis, 'input', 2, 'rancid', 'trapmf', c(0,0,1,3))
> fis= addmf(fis, 'input', 2, 'delicious', 'trapmf', c(7,9,10,10))
> fis= addmf(fis, 'output', 1, 'cheap', 'trimf', c(0,5,10))
> fis= addmf(fis, 'output', 1, 'average', 'trimf', c(10,15,20))
> fis= addmf(fis, 'output', 1, 'generous', 'trimf', c(20,25,30))
> rules= rbind(c(1,1,1,1,2), c(2,0,2,1,1), c(3,2,3,1,2))
> fis= addrule(fis, rules)
> showrule(fis)
1. If (service is poor) or (food is rancid) then (tip is cheap) (1)
2. If (service is good) then (tip is average) (1)
3. If (service is excellent) or (food is delicious) then (tip is generous) (1)
> fis=addrule(fis,c(2,2,1,1,1))
> showrule(fis)
1. If (service is poor) or (food is rancid) then (tip is cheap) (1)
2. If (service is good) then (tip is average) (1)
3. If (service is excellent) or (food is delicious) then (tip is generous) (1)
4. If (service is good) and (food is delicious) then (tip is cheap) (1)
> evalfis(rbind(c(3,5), c(2,7)), fis)
[,1]
[1,] 12.218379
[2,] 7.788532
> gensurf(fis)