I try to use the function, but I have a problem when I'm driving.
I have a matrix A (193.1) I would like to create a matrix (193.3) whose sum equals one line to my matrix A.
I tried the following code but I meet an error:
Rhedgefund = Y (:, 1);
cols_to_generate = 3;
for K = 1: length (Y)
Neva (K, :) = randfixedsum (1 cols_to_generate, Y (K), -0.15, 0.15);
He told me:
Index EXCEEDS matrix dimensions.
Error in randfixedsum (line 95)
x = (b-a) * x (p + repmat ([0: n: n * (m-1)] n, 1)) + a; % Switches & rescale x
95 x = (b-a) * x (p + repmat ([0: n: n * (m-1)] n, 1)) + a; % Switches & rescale x
I do not know how to solve problem
i am trying to generate 6 random nmbrs within given range and sum:
xmin=[10 10 40 35 130 125];
xmax=[125 150 250 210 325 315];
it is giving following error:
?? Error using ==> minus
Matrix dimensions must agree.
Error in ==> randfixedsum at 56
s1 = s - (k:-1:k-n+1); % s1 & s2 will never be negative
Error in ==> busdatas at 47
can sm1 tell wats wrong..i cnt figure it out..