Hey there!!!!I am getting this preallocation warning.How can i fix this??Need your help!!
close all;clear;figure;n=100000;p=.301;q=.15;beta=10;lambda=3;timeofprobabilityestimation=60;interval=.1;for c=[400 500 600 700] i=1; pest=[]; totaltime=zeros(n,1); for k=1:n x=sum(rand(c,1)<p); y=ceil(log(1-rand(x,1))/log(1-q)); totaltasks=sum(y); t=sum(-1/lambda * log(rand(beta,totaltasks))); totaltime(k)=sum(t); end for timeval=0:60*interval:60*100 pest(i)=mean(totaltime<timeval);%this is where i get warning
i=i+1; end timeval=0:interval:100; plot(timeval,pest) hold on;endlegend('400', '500' ,'600', '700')title('Total time vs probability')xlabel('total time less than h')ylabel('probability')
Best Answer