Advertisement
AndrzejO

zad1

May 21st, 2020
2,346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scilab 0.86 KB | None | 0 0
  1. clc;
  2. clear;
  3. Z=zeros(7,101);
  4.  
  5. for i=1:101
  6.     x=i;
  7.     Z(1,i)=x;
  8.     //term A
  9.     if x>=30 & x<=40
  10.     uA=(x-30)/10;    
  11.     elseif x >= 40 & x <=50
  12.     uA=(50-x)/10;
  13.     else
  14.     uA = 0;
  15.     end;
  16.     Z(2,i)=uA;
  17.     //term B
  18.     if x>=40 & x<=60
  19.     uB=(x-40)/20;    
  20.     elseif x >= 60 & x <=70
  21.     uB=(70-x)/10;
  22.     else
  23.     uB = 0;
  24.     end;
  25.     Z(3,i)=uB;
  26.     //operacja przeciecia(min)
  27.     Z(4,i)= min( Z(2,i),Z(3,i) );
  28.     //operacja sumy(max)
  29.     Z(5,i)= max( Z(2,i),Z(3,i) );
  30.     //operacja dopelnienia A
  31.     Z(6,i)= 1-(Z(2,i));
  32.     //operacja dopelnienia B
  33.     Z(7,i)= 1-(Z(3,i));
  34. end
  35.  
  36. //plot(Z(1,:),Z(2,:)); //term A
  37. //plot(Z(1,:),Z(3,:)); //term B
  38. //plot(Z(1,:),Z(4,:)); //przeciecie
  39. //plot(Z(1,:),Z(5,:)); //suma
  40. //plot(Z(1,:),Z(6,:)); //dopelnienie A
  41. plot(Z(1,:),Z(7,:)); //dopelnienie B
  42. mtlb_axis([0 100 0 1.2]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement