Matlab: Why is my plot not converging? -
would able me understand why plot not converge? missing code? plotting mean , variance against number of trials. thx
samplesize = 10; trialsize = 1000; firstvector = [1:trialsize]; vectorb = zeroes(trialsize,1); vectorc = zeroes(trialsize,1) i=1:trialsize v1 = rand(samplesize, 1) vectorb(i) = mean(v1); vectorc(i) = var(v1); end plot(firstvector,vectorb) plot(firstvector,vectorc)
is wanted do? take mean , var of 10 more samples @ time? 1st loop take 10, next 20, next 30 .... 1000 times?
before taking mean , var of 10 random samples @ time ... never going converge.
samplesize = 10; trialsize = 1000; firstvector = [1:trialsize]; vectorb = zeros(trialsize,1); vectorc = zeros(trialsize,1); v1 = rand(trialsize*samplesize, 1); i=1:trialsize vectorb(i) = mean(v1(1:i*samplesize)); vectorc(i) = var(v1(1:i*samplesize)); end subplot(2,1,1);plot(firstvector,vectorb) subplot(2,1,2);plot(firstvector,vectorc)
Comments
Post a Comment