I am trying to make a loop to redo a Matlab function 1000 times. Here’s the program
d = unifrnd (0,10,[10,1]);
c = d.^(-2);
a = round(unifrnd(0,1,[1,10]);
e = a*c
btotal = e+1
SIR = 1/btotal
What I want is to iterate this function 1000 times, each time the value of SIR will vary due to the random number generated. For every iteration, I want the value of SIR to be added together (summed up), and in the end of the 1000th iteration, find the average SIR(mean).
Thanks for the help
The code below implements what you described:
genSIR.m
main program
although your function could be simplified…