function yfinal = signal_3A_montecarlo() % signal_3A_montecarlo.m % % Code for running Monte Carlo simulations, based on signal_mod3 model % Authors: Jerry Chen and Joseph Mahaffy % Last updated: May 12, 2014 % Initialize simulation % clear;clc; N = 58; % Initial number of midline cells M = 1000; % Number of iterations in Monte carlo simulation t0 = 0:1:4000; % Number of time steps in each simulation yfinal = []; parfor i = 1:M i y0=rand(2*N,1); % Random low initial conditions % Simulate - Uses signal_mod3 model (nearest neighbor communication and % average boundary [t1,y1] = ode23(@signal_mod3,t0,y0,[],N); [maxr,maxc] = size(y1); ylastrow = y1(maxr,:); yfinal = [yfinal; ylastrow]; % dlmwrite('y_out.txt',ylastrow,'-append'); % Visualize simulation (can comment this block out when running % large-scale Monte Carlo simulation) [s1 s2] = size(y1); k = 1:2:2*N; it0 = 1:s1; dy = y1(it0,k); ny = y1(it0,k+1); tn = 1:N; for j = 1:s1 subplot(2,1,1) bar(tn,ny(j,tn),'g') ylabel('Notch'); subplot(2,1,2) bar(tn,dy(j,tn),'g') ylabel('Delta'); pause(0.003); end end return