📄 福利彩票3d的matlab模拟程序.m
字号:
% 福利彩票3D的Matlab模拟程序
%
axes('position',[0.1,0.8,0.8,0.1]);
text(0,0,'simulate 3D game','fontsize',18);
axis off;
axes('position',[0.6,0.8,0.3,0.2],'Visible','off');
bb=text(0.1,0.5,'0','fontsize',24);q=0;
axes('position',[0.3,0.23,0.6,0.1]);
tt=text(0,0,'please press "space" to stop!',...
'fontsize',18);
axis off;
axes('position',[0.1,0.4,0.2,0.3]);
t1=text(0.3,0.5,'3','fontsize',60);
box on;
set(gca,'xtick',[],'ytick',[]);
set(gca,'xticklabel',[],'yticklabel',[]);
axes('position',[0.4,0.4,0.2,0.3]);
t2=text(0.3,0.5,'3','fontsize',60);
box on;
set(gca,'xtick',[],'ytick',[]);
set(gca,'xticklabel',[],'yticklabel',[]);
axes('position',[0.7,0.4,0.2,0.3]);
t3=text(0.3,0.5,'3','fontsize',60);
box on;
set(gca,'xtick',[],'ytick',[]);
set(gca,'xticklabel',[],'yticklabel',[]);
set(gcf,'doublebuffer','on');
k=1;DD=[];
fid = fopen('save_data.txt','wt');
while k
s=get(gcf,'currentkey');
if strcmp(s,'space');
clc;k=0;
end
d=fix(rand(1,3)*10*(1-eps));
a=num2str(d(1));
b=num2str(d(2));
c=num2str(d(3));
set(t1,'string',a);
set(t2,'string',b);
set(t3,'string',c);
set(tt,'color',rand(1,3));
q=q+1;set(bb,'string',num2str(q));
p=num2str(d);
fprintf(fid,'%c',p);
fprintf(fid,'%c\n',' ');
DD=[DD;d];
pause(0.2);
end
fclose(fid);
figure(gcf);
figure;
plot(1:size(DD,1),DD(:,1),'rs','MarkerFaceColor','r');
legend('first');
figure;
plot(1:size(DD,1),DD(:,2),'gs','MarkerFaceColor','g');
legend('second');
figure;
plot(1:size(DD,1),DD(:,3),'bs','MarkerFaceColor','b');
legend('third');
dos('save_data.txt');
delete save_data.txt
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -