Shailrshah

Triangular Membership Function

Feb 5th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.25 KB | None | 0 0
  1. alpha=10;
  2. beta = 25;
  3. gamma = 40;
  4. for i=1:10
  5.   x(i) = i*5
  6.   if x(i)<=alpha
  7.     y(i)=0;
  8.   elseif x(i)<=beta
  9.     y(i) = (x(i)-alpha)/(beta-alpha)
  10.   elseif x(i) <=gamma
  11.      y(i)=(gamma-x(i))/(gamma-beta);
  12.   else
  13.     y(i) = 0;
  14.   end
  15. end
  16. plot(x,y)
Add Comment
Please, Sign In to add comment