nested for loops and plotting
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
fatih goncagül
el 20 de Jun. de 2020
Respondida: fatih goncagül
el 21 de Jun. de 2020
hi there!!I need a graph something like below for the values 400 500 600 700 but I cant find where my problem is.Please help!!
proportion2 gives 4 values
when process comes to plotting it runs and runs for too long and there is nothing on the screen.
N=int32((0.25)*(2.575/0.01)^2)
C=600
p=0.301
d=0.15 %Geometric distribution with parameter%
beta=10
lambda=3
TotalTime=zeros(N,1);
hold on
for C=[400 500 600 700]
for k=1:N %N is 16577%
X1=sum(rand(C,1)<p);
Y1=ceil(log(1-rand(X1,1))/log(1-d));
TotalTasks2=sum(Y1);
T2=sum(-1/lambda * log(rand(beta,TotalTasks2)));
TotalTime(k)=sum(T2);
end
proportion2=mean(TotalTime<3600)
plot(TotalTime/60,proportion2 )
end

2 comentarios
Walter Roberson
el 20 de Jun. de 2020
N is 16577, and we know that p is 0.3 from one of your previous questions, but what is d and what is lambda and what is beta ?
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 21 de Jun. de 2020
total time is a vector. mean of a vector is a scalar. You are plotting with a bunch of different x values and a single y value.. note that your total time values are not sorted so you are not even drawing some kind of bar showing maximum and minimum.
0 comentarios
Ver también
Categorías
Más información sobre Performance and Memory en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!