Maximum recursion limit of 500 reached error in matlab.
5 次查看(过去 30 天)
显示 更早的评论
I have downloaded matlab file "Random vectors with fixed sum" I got following error
Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N) to change the limit. Be aware that exceeding your available
stack space can crash MATLAB and/or your computer.
Error in randfixedsum
I attach file Random vectors with fixed sum. how to solve this error.
0 个评论
采纳的回答
Walter Roberson
2016-10-24
Remove the three lines you added,
m=6;n=6; a=0.3; b=0.5;s=2
[x,v] = randfixedsum(n,m,s,a,b)
set(0,'RecursionLimit',N)
Now in a different .m file, put in
m=6;n=6; a=0.3; b=0.5;s=2
[x,v] = randfixedsum(n,m,s,a,b)
12 个评论
更多回答(1 个)
Roger Stafford
2016-10-25
The code for ‘randfixedsum’ was written to have each column, not each row, of the resulting matrix x have the given sum s. If you want the rows to have the given sum, you will have to do a transpose on x.
As to the question of uniformity, there is a profound difference between a statistically uniform distribution and a strictly uniform distribution. The example of the figure which I included in the file exchange entry for randfixedsum at:
http://www.mathworks.com/matlabcentral/fileexchange/9700-random-vectors-with-fixed-sum
has the values m = 3, n = 16384, s = 1.25, a = 0, and b = 1. This means that in each of the 16384 columns of the output x the sum of the three elements (xyz coordinates) must equal 1.25, and all element values must lie between 0 and 1. In the figure this implies that all the red dots must lie within the planar hexagon shown there, and their distribution throughout the hexagon is uniform in a statistical sense, though not in a strict sense. Of course, in your example with only three samples (columns) the statistical uniformity cannot be very evident - a figure illustrating it would have only three dots at some random locations within the corresponding hexagon (or triangle.)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!