Maximum recursion limit of 500 reached error in matlab.

2 ビュー (過去 30 日間)
Jay Hanuman
Jay Hanuman 2016 年 10 月 24 日
コメント済み: Walter Roberson 2016 年 10 月 26 日
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.

採用された回答

Walter Roberson
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 件のコメント
Jay Hanuman
Jay Hanuman 2016 年 10 月 25 日
Thank you Walter Roberson
Walter Roberson
Walter Roberson 2016 年 10 月 26 日
Please Accept an answer if the Question is solved.

サインインしてコメントする。

その他の回答 (1 件)

Roger Stafford
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.)
  1 件のコメント
Jay Hanuman
Jay Hanuman 2016 年 10 月 25 日
Thank you Roger Stafford

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by