for i=1:inf; %寻找乘梯人数
x(i)=ceil(30*rand(1)); %来人时间间隔(0,30)
sum1(i+1)=sum1(i)+x(i); %计算总计时间
n=n+1; %计算全部人数
if sum1(i+1)>=4800; %超过时间结束循环
break
else
end
end
for i=1:n
goal(i)=ceil(11*rand(1));
end
Warning: FOR loop index is too large. Trunca
ting to 281474976710655.
??? Undefined function or method 'sum1' for input arguments of type 'double'.
MATLAB编的,都对,就是输出时就像上面那样
一周热门 更多>