Effacer les filtres
Effacer les filtres

Maximum recursion limit of 500 reached error in matlab.

6 vues (au cours des 30 derniers jours)
Jay Hanuman
Jay Hanuman le 24 Oct 2016
Commenté : Walter Roberson le 26 Oct 2016
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.

Réponse acceptée

Walter Roberson
Walter Roberson le 24 Oct 2016
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)
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 commentaires
Jay Hanuman
Jay Hanuman le 25 Oct 2016
Thank you Walter Roberson
Walter Roberson
Walter Roberson le 26 Oct 2016
Please Accept an answer if the Question is solved.

Connectez-vous pour commenter.

Plus de réponses (1)

Roger Stafford
Roger Stafford le 25 Oct 2016
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:
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.)


En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by