使用MatLab对gierer-meinhardt系统进行模式形成刺激



我正在研究Gierer-Meinhardt反应扩散系统,我试图对模型进行编码以产生一些图案,如斑点或条纹。我已经计算了图灵不稳定空间并使用该空间的值用作输入,但几秒钟后屏幕变为空白!所以可能是错误的数学,也可能是错误的代码,这是为了我的学位,任何帮助都会很棒!

function gierermeinhardt(a, b) % Diffusion rates
D=2; % Size of grid width = 128; % 5,000 simulation seconds with 4 steps per simulated second
dt = .25;
stoptime = 3000;
[t, u, v] = initial_conditions(width);
axes('Position',[0 0 1 1]) axis off   % Add a scaled-color image
hi = image(v);
set(hi,'CDataMapping','scaled');
targetframerate = 6; %24;
frametime = 1/(24*60*60*targetframerate);
nextframe = now + frametime;
tic nframes = 1;
while t<stoptime
    ut = u + (a - b*u + u.^2./v  + my_laplacian(u))*dt;
    vt = v + (u.^2 - v + D.*my_laplacian(v))*dt;
    u = ut;
    v = vt;
    set(hi,'CData',v);
    t = t+dt;
    ht.String = ['Time = ' num2str(t)];
    if now > nextframe
        drawnow
        nextframe = now + frametime;
    end
    nframes = nframes+1;
end delta = toc;
disp([num2str(nframes) ' frames in ' num2str(delta) ' seconds']);
function out = my_laplacian(in)
out = -in ...       + .20*(circshift(in,[ 1, 0]) + circshift(in,[-1, 0])  ...       +      circshift(in,[ 0, 1]) + circshift(in,[ 0,-1])) ...       + .05*(circshift(in,[ 1, 1]) + circshift(in,[-1, 1])  ...       +      circshift(in,[-1,-1]) + circshift(in,[ 1,-1]));
function [t, u, v] = initial_conditions(n)
t = 0; % Initialize A to one
v = ones(n); % Initialize B to zero which a clump of ones
u = zeros(n);
u(51:60 ,51:70) = 1;
u(61:80,71:80) = 1;

我在 Octave 下运行了你的程序,所以可能会有所不同,但我认为我明白问题是什么。

首先,你的头衔,ht。字符串,似乎没有去任何地方图(正如我们稍后将看到的,这很重要(。 我把它改成了

s = text(40,10, 'Time = 0');

还有:

if now > nextframe
    set(s,'string', ['Time = ',num2str(t),' 1+', num2str(min(min(v))-1),' <= v <= 1+',num2str(max(max(v))-1)])
    drawnow
    nextframe = now + frametime;
end

播放的电影取决于 a 和 b 的值,我选择了 a=1; b=2 。然后我得到的是,v的值都等于1+2.2e-16t=145后. 这意味着整个图形只有一种颜色。而且,在没有标题的情况下,这是一个"空白屏幕"。

最新更新