Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sum_r = 0;
- N = 12;
- nu_0 = 0;
- nu = 0;
- t1 = 0; t2 = 0; t3 = 0; t4 = 0;
- function [nu_0]= Time_calc(r)
- for i = 1:N
- sum_r = sum_r + r;
- end
- nu_0 = (sum_r - N/2)/(sqrt(N/12));
- endfunction
- for i = 1:400
- r = rand();
- nu = (Time_calc(r))*0.6 + 3.2;
- msg = 0;
- if r >= 0 & r < 0.03 then t1 = t1 + 1;
- msg = 1;
- else if r >= 0.03 & r < 0.60 then t2 = t2 + 1;
- msg = 2;
- else if r >= 0.60 & r < 0.73 then t3 = t3 + 1;
- msg = 3;
- else t4 = t4 + 1;
- msg = 4;
- end;
- end;
- end;
- printf('Рандомное число: %f Тип сообщения:%i Время???: %f \n',r,msg,nu);
- end
- disp('____________________');
- disp(t1);
- disp(t2);
- disp(t3);
- disp(t4);
- disp('____________________');
- disp(t1/(400));
- disp(t2/(400));
- disp(t3/(400));
- disp(t4/(400));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement