资源简介
基于元胞自动机的Matlab仿真程序,都可以运行,还不错哦!拿来和大家分享!
代码片段和文件信息
%Conway‘s life with GUI
clf
clear all
%=============================================
%build the GUI
%define the plot button
plotbutton=uicontrol(‘style‘‘pushbutton‘...
‘string‘‘Run‘ ...
‘fontsize‘12 ...
‘position‘[1004005020] ...
‘callback‘ ‘run=1;‘);
%define the stop button
erasebutton=uicontrol(‘style‘‘pushbutton‘...
‘string‘‘Stop‘ ...
‘fontsize‘12 ...
‘position‘[2004005020] ...
‘callback‘‘freeze=1;‘);
%define the Quit button
quitbutton=uicontrol(‘style‘‘pushbutton‘...
‘string‘‘Quit‘ ...
‘fontsize‘12 ...
‘position‘[3004005020] ...
‘callback‘‘stop=1;close;‘);
number = uicontrol(‘style‘‘text‘ ...
‘string‘‘1‘ ...
‘fontsize‘12 ...
‘position‘[204005020]);
%=============================================
%CA setup
n=128;
%initialize the arrays
z = zeros(nn);
cells = z;
sum = z;
%set a few cells to one
cells(n/2.25*n:.75*n) = 1;
cells(.25*n:.75*nn/2) = 1;
%cells(.5*n-1.5*n-1)=1;
%cells(.5*n-2.5*n-2)=1;
%cells(.5*n-3.5*n-3)=1;
cells = (rand(nn))<.5 ;
%how long for each case to stability or simple oscillators
%build an image and display it
imh = image(cat(3cellszz));
set(imh ‘erasemode‘ ‘none‘)
axis equal
axis tight
%index definition for cell update
x = 2:n-1;
y = 2:n-1;
%Main event loop
stop= 0; %wait for a quit button push
run = 0; %wait for a draw
freeze = 0; %wait for a freeze
while (stop==0)
if (run==1)
%nearest neighbor sum
sum(xy) = cells(xy-1) + cells(xy+1) + ...
cells(x-1 y) + cells(x+1y) + ...
cells(x-1y-1) + cells(x-1y+1) + ...
cells(3:ny-1) + cells(x+1y+1);
% The CA rule
cells = (sum==3) | (sum==2 & cells);
%draw the new image
set(imh ‘cdata‘ cat(3cellszz) )
%update the step number diaplay
stepnumber = 1 + str2num(get(number‘string‘));
set(number‘string‘num2str(stepnumber))
end
if (freeze==1)
run = 0;
freeze = 0;
end
drawnow %need this in the loop for controls to work
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2010-09-09 20:09 CA+matlab\CA matlab\
目录 0 2010-09-09 20:09 CA+matlab\CA matlab\CA.files\
文件 3101 2006-05-15 10:47 CA+matlab\CA matlab\CA.files\Diffusion1.gif
文件 25386 2006-05-15 10:47 CA+matlab\CA matlab\CA.files\excitable1.png
文件 35874 2006-05-15 10:47 CA+matlab\CA matlab\CA.files\percolationSmall.png
文件 19456 2010-03-14 09:50 CA+matlab\CA matlab\CA.files\Thumbs.db
文件 29081 2006-05-15 10:50 CA+matlab\CA matlab\CA.htm
文件 2226 2006-05-15 10:50 CA+matlab\CA matlab\calife.m
文件 2248 2006-05-15 10:50 CA+matlab\CA matlab\CAsurfaceT.m
文件 1210 2006-05-15 10:50 CA+matlab\CA matlab\CAvine.m
文件 1789 2006-05-15 10:49 CA+matlab\CA matlab\diffusion.m
文件 1208 2006-05-15 10:49 CA+matlab\CA matlab\excitable.m
文件 803 2006-05-15 10:49 CA+matlab\CA matlab\forest.m
文件 3196 2006-05-15 10:49 CA+matlab\CA matlab\gas2.m
文件 2153 2006-05-15 10:49 CA+matlab\CA matlab\sand.m
相关资源
- HOG方向梯度直方图matlab源程序
- NSGA-II matlab程序+by Aravind Seshadri
- SVD算法的MATLAB实现代码
- FCM聚类算法,可直接matlab运行
- HMM的Matlab代码
- GM11模型matlab程序
- 机械优化设计之二次插值法matlab
- matlab GUI计算器设计
- 通过matlab读取同一路径下多个txt或者
- 无线定位基本算法Matlab
- 转差频率控制的的电机仿真模型
- Rossler_混沌系统Lyapunov指数Matlab实现代
- 基于matlab的医学脑部分割
- 基于MATLAB的语音信号处理课程设计
- Matlab基于全局阈值处理的图像二值分
- matlab仿真PID控制系统
- 使用遗传算法优化BP神经网络权值 的
- 最小交叉熵matlab
- 升余弦滚降滤波程序MatLAB
- matlab小波软阈值去噪代码
- matlab 三维傅里叶快速算法 fft
- 利用matlab进行双目标优化
- 用matlab读取txt文件然后画图
- QR算法求矩阵特征值的matlab实现
- 计算测地距离的matlab代码
- 局部线性嵌入LLE的matlab代码
- Matlab有限元编程源代码.rar
- 比例公平调度matlab源程序
- matlab空间中任意一点上画圆柱
- 任意阵列的常规波束形成matlab程序
评论
共有 条评论