PLEASE WRITE A PROGRAM IN MATLAB FOR THE FOLLOWING:
SOLUTION
Awin=0;
Bwin=0;
Cwin=0;
Dwin=0;
ran=[10,100,1000];
for i=ran
Awin=[Awin;i*0.3];
Bwin=[Bwin;i*0.4];
Cwin=[Cwin;i*0.2];
Dwin=[Dwin;i*0.1];
endfor
ran=[0,ran]
plot (ran,Awin,ran,Bwin,ran,Cwin,ran,Dwin);
xlabel ("Total Races");
ylabel ("Won Races");
legend('Horse-1','Horse-2','Horse-3','Horse-4');
title ("HORSE-RACE PLOT");
Here Awin , Bwin , Cwin & Dwin stores the number of winning races by respective horses (A,B,C & D).
Awin=[Awin;i*0.3] => since the winning of horse A is 30% therefore it can also be written as :
(Number of Matches x 30) /100 =Number of Wins of Horse A.
Therefore we can also right it as : (Number of Matches x 0.3) = Number of Wins of Horse A.
here in the loop number of matches is determined by i , this is how this statement calculates the winning matches.
Hope this helps. If you like the answer please rate it.
Thanks!
Probability Practice Simulating the Horse Races Four horses (A, B, C, and D) have raced many ti m...