Difference and probability in plot
이전 댓글 표시
Hello I tried to plot this but it's show me "Vectors must be the same length.
Error in (line 17)
plot(difference,probability,'b--'"
would you please help me to fix the problem?
thanks in advance.
difference=[];
probability=[];
for diff=-5:1:5
sum=0;
for g=1:6
for r=1:6
if(g-r==diff)
sum=sum+(1/36);
end
end
end
differnce=[difference diff];
probability=[probability sum];
end
figure
plot(difference,probability,'b--')
xlabel('D');
ylabel('P');
axis([-5 5 0 .2]);
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Half-Normal Distribution에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!