Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clc
- clear
- Z=zeros(5,181);
- for i=1:181
- x=i-1;
- Z(1,i) = x;
- // A
- if x>= 0 & x <= 40 then
- uA = (40 - x) / (40 - 0);
- else uA = 0
- end
- Z(2,i) = uA;
- // B
- if x>= 20 & x <= 40
- uA = (x - 20) / (40 - 20);
- elseif x >= 40 & x <= 60
- uA = 1;
- elseif x >= 60 & x <= 90
- uA = (90 - x) / (90 - 60);
- else
- uA = 0;
- end
- Z(3,i) = uA;
- // C
- if x >= 70 & x <= 100
- uA = (x - 70 ) / (100 - 70);
- elseif x >= 100 & x <= 130
- uA = (130 - x) / (130 - 100);
- else
- uA = 0
- end
- Z(4,i) = uA;
- // D
- if x >= 110 & x <= 140
- uA = (x - 110) / (140 - 110);
- elseif x >= 140 & x <= 180
- uA = 1;
- elseif x >= 180 & x <= 180
- uA = (180 - x) / (180 - 180);
- else
- uA = 0;
- end
- Z(5,i) = uA;
- end
- plot(Z(1,:), Z(2,:));
- plot(Z(1,:), Z(3,:));
- plot(Z(1,:), Z(4,:));
- plot(Z(1,:), Z(5,:));
- mtlb_axis([0 180 0 1.2])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement