Asked by Conor
on 5 Feb 2013

Need to create a loop that doubles the number of points in a random data set, starting at 50 and going to 51,200 in factors of 2.

So far Ive got this, which doesnt seem to work, as it gives me a 1x51200 matrix of randomly generated numbers:

for i=1:1024, randn(1,50.*i) end

Would appreciate any help.

Thanks!

*No products are associated with this question.*

Answer by Walter Roberson
on 5 Feb 2013

R = randn(1,50); for K = 1 : 10 R = [R, randn(1,length(R))]; fprintf('new size is %d\n', length(R)) end

Opportunities for recent engineering grads.

## 2 Comments

## bym (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/62212#comment_127143

Not sure what you mean -- does the initial data set vary between 50 and 51200 elements and you want to double the number of elements?

## Azzi Abdelmalek (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/62212#comment_127145

Why are using a for loop, if you are not storing your calculations. And what should be the final result?