function [ y ] = dobbelspel2p
aantalworpen1 = 0;
waarde1 = 0;
while waarde1 < 40
dobbelsteen1 = ceil(6*rand);
dobbelsteen2 = ceil(6*rand);
worp = dobbelsteen1 + dobbelsteen2;
if dobbelsteen1 ~= dobbelsteen2
waarde1 = waarde1+worp;
end
aantalworpen1 = aantalworpen1 +1;
end
while waarde1 < 51
dobbelsteen3 = ceil(6*rand);
if waarde1 + dobbelsteen3 <= 51;
waarde1 = waarde1 + dobbelsteen3;
end
aantalworpen1 = aantalworpen1 +1;
end
aantalworpen2 = 0;
waarde2 = 0;
while waarde2 < 40
dobbelsteen1 = ceil(6*rand);
dobbelsteen2 = ceil(6*rand);
worp = dobbelsteen1 + dobbelsteen2;
if dobbelsteen1 ~= dobbelsteen2
waarde2 = waarde2+worp;
end
aantalworpen2 = aantalworpen2 +1;
end
while waarde2 < 51
dobbelsteen3 = ceil(6*rand);
if waarde2 + dobbelsteen3 <= 51;
waarde2 = waarde2 + dobbelsteen3;
end
aantalworpen2 = aantalworpen2 +1;
end
if aantalworpen1 < aantalworpen2
y = 1;
aantalworpen1
elseif aantalworpen1 > aantalworpen2
y = 2;
aantalworpen2
else aantalworpen1 == aantalworpen2
y =0;
aantalworpen1
end
plot(waarde1,waarde2,'r-')
hold on
end
3 Comments
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/316693-how-to-plot-a-function-file#comment_413401
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/316693-how-to-plot-a-function-file#comment_413401
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/316693-how-to-plot-a-function-file#comment_413415
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/316693-how-to-plot-a-function-file#comment_413415
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/316693-how-to-plot-a-function-file#comment_421842
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/316693-how-to-plot-a-function-file#comment_421842
Sign in to comment.