I need to store up the different random for each realisation.

22 views (last 30 days)

Show older comments

for kk = 1 : Iter

xD = rand(N,1)*2*pi; % Init Cond. Driver

end

Wiley Mosley
on 3 Jul 2020

Edited: Wiley Mosley
on 3 Jul 2020

rng(1,'twister'); % init generator for random repeatable with seed 1

s = rng; % save generator settings as s

for kk = 1: Iter

xD = rand (N, 1) * 2 * pi; % Init Cond. Driver

end

disp(xD) %just to print out your xD values

rng(s) % Reset the generator

for kk = 1: Iter

xD = rand (N, 1) * 2 * pi; % Init Cond. Driver

end

disp(xD) %printing out the xD values again should show that they match

I believe somthing like this should help you.

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

Start Hunting!