Write a script to compute the average number of integers over 1000 trails for different thresh holds
1 次查看(过去 30 天)
显示 更早的评论
Write a script named random_walk that computes the average number of integers over 1000 trials for different thresholds, starting at 50, stepping by 10, and ending at 300. Your script should create a vector containing these averages. For example,
aveCounts = 1.0e+04 *
Columns 1 through 11
0.0077 0.0184 0.0330 0.0522 0.0746 0.1020 0.1355 0.1764 0.2248 0.2781 0.3424
Columns 12 through 22
0.4082 0.4870 0.5780 0.6816 0.7957 0.9165 1.0519 1.2062 1.3754 1.5493 1.7395
Columns 23 through 26
1.9444 2.1580 2.3984 2.6594
count=wander(thresh)
tot=0
for i=1000
count=randi([-10,10])
while abs(tot) <= thresh
tot=tot+randi([-10,10],1)
count=count+1
end
end
so im having problems getting the right output and then putting it into a vector
1 个评论
Rik
2019-11-26
The assignment is not clear enough for me to be able to help you. If you can further explain the assignment, I should be able to give you a hint.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Clocks and Timers 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!