bar plot problem
古いコメントを表示
hello i"m trying to graph a bar plot from form .1 to .9 based on this index p=.1:.1:.1 but its graphing from it seems to be plotting from about -.3 to 1.3 can someone help me please fix this
win=0 step=0 for p=.1:.1:.9
for i=1:1:100
a=3
b=3
c=3
while a>0 && b>0 && c>0
step=step+1
d=rand(1,3)
if d(1,1)<p && d(1,2)<p && d(1,3) <p
a=a+0
b=b+0
c=c+0
elseif d(1,1)>p && d(1,2) >p &&d(1,3) >p
a=a+0
b=b+0
c=c+0
elseif d(1,1)<p && d(1,3) < p
a= a -1
b= b+2
c= c-1
elseif d(1,1)>p &&d(1,3) >p
a= a -1
b= b+2
c= c-1
elseif d(1,3)<p &&d(1,2) < p
a= a +2
b= b-1
c= c-1
elseif d(1,2)>p && d(1,3) >p
a= a +2
b= b-1
c= c-1
elseif d(1,1)<p &&d(1,2) < p
a= a -1
b= b-1
c= c+2
elseif d(1,1)>p && d(1,2) >p
a= a -1
b= b-1
c= c+2
end
end
win=win+1
end
%axis([0 1 0 75])
avg=step/100
bar(p,avg)
hold on
end
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Bar Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!