Advertisement
Guest User

Untitled

a guest
Mar 10th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scilab 1.00 KB | None | 0 0
  1. clc
  2. clear
  3. Z=zeros(5,181);
  4. for i=1:181
  5.     x=i-1;
  6.     Z(1,i) = x;
  7. // A
  8.     if x>= 0 & x <= 40 then
  9.         uA = (40 - x) / (40 - 0);
  10.         else uA = 0
  11.     end
  12.     Z(2,i) = uA;
  13. // B
  14.     if x>= 20 & x <= 40
  15.         uA = (x - 20) / (40 - 20);
  16.     elseif x >= 40 & x <= 60
  17.         uA = 1;
  18.     elseif x >= 60 & x <= 90
  19.         uA = (90 - x) / (90 - 60);    
  20.     else
  21.          uA = 0;
  22.     end
  23.     Z(3,i) = uA;
  24. // C  
  25.     if x >= 70 & x <= 100
  26.         uA = (x - 70 ) / (100 - 70);
  27.     elseif x >= 100 & x <= 130
  28.         uA = (130 - x) / (130 - 100);
  29.     else
  30.         uA = 0
  31.     end
  32.     Z(4,i) = uA;
  33. // D
  34.     if x >= 110 & x <= 140
  35.         uA = (x - 110) / (140 - 110);
  36.     elseif x >= 140 & x <= 180  
  37.         uA = 1;
  38.     elseif x >= 180 & x <= 180
  39.         uA = (180 - x) / (180 - 180);    
  40.     else
  41.          uA = 0;
  42.     end
  43.     Z(5,i) = uA;
  44.    
  45.    
  46. end
  47.  
  48. plot(Z(1,:), Z(2,:));
  49. plot(Z(1,:), Z(3,:));
  50. plot(Z(1,:), Z(4,:));
  51. plot(Z(1,:), Z(5,:));
  52. mtlb_axis([0 180 0 1.2])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement