nested for loops and plotting
5 views (last 30 days)
Show older comments
fatih goncagül
on 20 Jun 2020
Answered: fatih goncagül
on 21 Jun 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 Comments
Walter Roberson
on 20 Jun 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 ?
Accepted Answer
More Answers (1)
Walter Roberson
on 21 Jun 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 Comments
See Also
Categories
Find more on Performance and Memory in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!