Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sistem(p)
- A = zeros(1,6);
- p=rand(1,6);
- for i = 1:6
- A(i) = Bern(p(i));
- end
- % Create figure
- figure1 = figure;
- % Create line
- annotation(figure1,'line',[0.0236486486486487 0.0802364864864865],...
- [0.50728729281768 0.50828729281768]);
- % Create line
- annotation(figure1,'line',[0.224662162162163 0.288851351351352],...
- [0.581872928176794 0.582872928176794]);
- % Create line
- annotation(figure1,'line',[0.223817567567568 0.288006756756757],...
- [0.722756906077347 0.723756906077346]);
- % Create line
- annotation(figure1,'line',[0.223817567567568 0.224662162162163],...
- [0.722756906077346 0.580110497237568]);
- % Create line
- annotation(figure1,'line',[0.344594594594596 0.408783783783785],...
- [0.728281767955799 0.729281767955799]);
- % Create line
- annotation(figure1,'line',[0.343750000000002 0.407939189189191],...
- [0.58463535911602 0.58563535911602]);
- % Create line
- annotation(figure1,'line',[0.40962837837838 0.410472972972975],...
- [0.728281767955799 0.585635359116021]);
- % Create line
- annotation(figure1,'line',[0.160472972972973 0.347128378378378],...
- [0.322204419889502 0.323204419889503]);
- % Create line
- annotation(figure1,'line',[0.161317567567568 0.225506756756757],...
- [0.653696132596685 0.654696132596685]);
- % Create line
- annotation(figure1,'line',[0.160472972972973 0.160472972972973],...
- [0.653696132596685 0.323204419889503]);
- % Create line
- annotation(figure1,'line',[0.131756756756757 0.161317567567568],...
- [0.510049723756906 0.511049723756906]);
- % Create arrow
- annotation(figure1,'arrow',[0.0337837837837838 0.0625],...
- [0.504524861878453 0.50828729281768]);
- % Create arrow
- annotation(figure1,'arrow',[0.596283783783785 0.645270270270272],...
- [0.482425414364641 0.483425414364641]);
- % Create line
- annotation(figure1,'line',[0.514358108108109 0.54391891891892],...
- [0.476900552486187 0.477900552486188]);
- % Create line
- annotation(figure1,'line',[0.402027027027028 0.511824324324324],...
- [0.349828729281767 0.348066298342541]);
- % Create line
- annotation(figure1,'line',[0.512668918918921 0.512668918918919],...
- [0.661983425414361 0.345303867403315]);
- % Create line
- annotation(figure1,'line',[0.409628378378379 0.43918918918919],...
- [0.66474585635359 0.66574585635359]);
- % Create line
- annotation(figure1,'line',[0.494932432432434 0.516891891891892],...
- [0.659220994475136 0.660220994475138]);
- % Create textbox
- if(A(1)==1)
- annotation(figure1,'textbox',...
- [0.077968146718146 0.450276243093922 0.0546332046332054 0.115706129965801],...
- 'String',{'A1'},...
- 'FitBoxToText','off',...
- 'BackgroundColor',[1 1 0]);
- else
- annotation(figure1,'textbox',...
- [0.077968146718146 0.450276243093922 0.0546332046332054 0.115706129965801],...
- 'String',{'A1'},...
- 'FitBoxToText','off',...
- 'BackgroundColor',[1 0 0]);
- end
- % Create textbox
- if(A(3)==1)
- annotation(figure1,'textbox',...
- [0.287427606177606 0.674033149171269 0.0546332046332054 0.115706129965801],...
- 'String',{'A3'},...
- 'FitBoxToText','off',...
- 'BackgroundColor',[1 1 0]);
- else
- annotation(figure1,'textbox',...
- [0.287427606177606 0.674033149171269 0.0546332046332054 0.115706129965801],...
- 'String',{'A3'},...
- 'FitBoxToText','off',...
- 'BackgroundColor',[1 0 0]);
- end
- % Create textbox
- if(A(3))
- annotation(figure1,'textbox',...
- [0.287427606177606 0.513812154696132 0.0546332046332053 0.115706129965801],...
- 'String',{'A2'},...
- 'FitBoxToText','off',...
- 'BackgroundColor',[1 1 0]);
- else
- annotation(figure1,'textbox',...
- [0.287427606177606 0.513812154696132 0.0546332046332053 0.115706129965801],...
- 'String',{'A2'},...
- 'FitBoxToText','off',...
- 'BackgroundColor',[1 1 0]);
- end
- % Create textbox
- if(A(4)==1)
- annotation(figure1,'textbox',...
- [0.438610038610041 0.599447513812153 0.0546332046332055 0.115706129965801],...
- 'String',{'A4'},...
- 'FitBoxToText','off',...
- 'BackgroundColor',[1 1 0]);
- else
- annotation(figure1,'textbox',...
- [0.438610038610041 0.599447513812153 0.0546332046332055 0.115706129965801],...
- 'String',{'A4'},...
- 'FitBoxToText','off',...
- 'BackgroundColor',[1 0 0]);
- end
- % Create textbox
- if(A(5)==1)
- annotation(figure1,'textbox',...
- [0.347393822393823 0.290055248618783 0.0546332046332055 0.115706129965801],...
- 'String',{'A5'},...
- 'FitBoxToText','off',...
- 'BackgroundColor',[1 1 0]);
- else
- annotation(figure1,'textbox',...
- [0.347393822393823 0.290055248618783 0.0546332046332055 0.115706129965801],...
- 'String',{'A5'},...
- 'FitBoxToText','off',...
- 'BackgroundColor',[1 0 0]);
- end
- % Create textbox
- if(A(6)==1)
- annotation(figure1,'textbox',...
- [0.541650579150581 0.417127071823203 0.0546332046332055 0.115706129965801],...
- 'String',{'A6'},...
- 'FitBoxToText','off',...
- 'BackgroundColor',[1 1 0]);
- else
- annotation(figure1,'textbox',...
- [0.541650579150581 0.417127071823203 0.0546332046332055 0.115706129965801],...
- 'String',{'A6'},...
- 'FitBoxToText','off',...
- 'BackgroundColor',[1 0 0]);
- end
- axis off;
- if A(1) == 1 && A(2) == 1 && A(4) == 1 && A(6) == 1
- title('Sistemul functioneaza');
- else if A(1) == 1 && A(3) == 1 && A(4) == 1 && A(6) == 1
- title('Sistemul functioneaza');
- else if A(1) == 1 && A(5) == 1 && A(6) == 1
- title('Sistemul functioneaza');
- else
- title('Sistemul nu functioneaza');
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement