nested for loops and plotting
5 次查看(过去 30 天)
显示 更早的评论
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 个评论
Walter Roberson
2020-6-20
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 ?
采纳的回答
更多回答(1 个)
Walter Roberson
2020-6-21
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Performance and Memory 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!