matlab 画粒子

AgentNumber = 63;
FrameNumber = 1;
 szBuffer = sprintf('reset.txt');
% szBuffer = sprintf('./pathFile/path_250_group/%02d.txt',frame); 
f1=fopen(szBuffer);
cla;
i=1;
while 1
nextline = fgetl(f1); %读第一行 
if ~isstr(nextline), break, end %读到最后跳出 
%disp(nextline);%这行可以不要 
a = sscanf(nextline, '%f %f');%读取数据,根据你自己的需要改 
 dataX(i) = a(1);
 dataY(i) = a(2);
i=i+1;
end 
fclose(f1);

 N = [dataX(:),dataY(:)];
fid=fopen('Si.txt','wt')


% [n C] = hist3([dataX(:) dataY(:)]);
% p=n/AgentNumber;
% colormap(flipud(gray))
% contourf(C{1},C{2},p);
% colorbar

for i=1:63
    plot(dataX,dataY,'.');
        scatter(dataX,dataY);
    grid on;
 box on;
    hold on;
end
box on;
% for i=1:15
%     plot([125,200],[-200+i*25,-200+i*25]);
%     hold on;
% end
% for i=1:2
%     plot([125+25*i,125+25*i],[-200,200]);
%     hold on;
% end
%  axis([125,200,-200,200])  
 axis([0,30,0,100])
set(gcf,'unit','normalized','position',[0.2,0.2,1,1]);%设置画布的宽高,matlab默认为正方形
%  set(gcf,'position',[100,-200,100,100]);
set(gca,'XTick',[0:10:30]) %改变x轴坐标间隔显示 这里间隔为10  
set(gca,'YTick',[0:50:100]) %改变y轴坐标间隔显示 这里间隔为10 


matlab 画粒子_第1张图片

你可能感兴趣的:(matlab 画粒子)