## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

APPENDIX

COMPUTER PROGRAMS

%tmfl evaluates left triangular membership function

%with corners m2 and m3 at point e function tmfl=tmfl(e,m2,m3)

if e<=m2

tmfl=1;

elseif e>m2 & e<m3

tmfl=-(1/(m3-m2))*e+m3/(m3-m2);

else

tmfl=0;

end

%tmf evaluates triangular membership function

%with corners m1, m2, and m3 at point e function tmf=tmf(e,m1,m2,m3)

if e>m1 & e<=m2

tmf=(1/(m2-m1))*e-m1/(m2-m1);

elseif e>m2 & e<m3

tmf=-(1/(m3-m2))*e+m3/(m3-m2);

else

tmf=0;

end

%tmfr evaluates right triangular membership function

%with corners m1 and m2 at point e function tmfr=tmfr(e,m1,m2)

if e>m1 & e<=m2

tmfr=(1/(m2-m1))*e-m1/(m2-m1);

elseif e>m2 tmfr=1;

else

tmfr=0;

end

%gmfl evaluates left gaussian membership function

%with center mid and spread sigma at point e function gmfl=gmfl(e,mid,sigma)

if e<=mid

gmfl=1;

else

gmfl=exp(-.5*((e-mid)/sigma)∧2);

end

%gmf evaluates gaussian membership function

%with center mid and spread sigma at point e function gmf=gmf(e,mid,sigma)

gmf=exp(-.5*((e-mid)/sigma)∧2);

%gmfr evaluates right gaussian membership function

%with center mid and spread sigma at point e function gmfr=gmfr(e, mid, sigma)

if e>mid

gmfr=1;

else

gmfr=exp(-.5*((e-mid)/sigma)∧2);

end

%script fig2p1

%generates Figure 2.1

%single triangular mf

close all

clear all

T=-5:.01:40; %range of temperatures for plotting

for i=1:length(T)

mfT(i)=tmf(T(i),15,25,35);

end

plot(T,mfT,‘k’,‘linewidth’,2),grid

axis([-5 40 0 1.2]);

%script fig2p2

%generates Figure 2.2

%single gaussian mf

close all

clear all

T=-5:.01:40; %range of temperatures for plotting ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required