samedi 7 avril 2018

Pattern formation stimulation for gierer-meinhardt system using MatLab

Please help!? I am studying the Gierer-Meinhardt reaction-diffusion system and I have tried to code up the model in order to produce some patterns, like spots or stripes. I have calculated the Turing instability space and used values from that space to use as an input, but after a couple of seconds the screen goes blank! So could be wrong maths, or could be wrong code, this is for my degree and any help would be amazing! :

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 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;

Aucun commentaire:

Enregistrer un commentaire