% I_T Max I_TminPerm = 0.00009 - 0.00004; I_TmaxPerm = 0.00009 + 0.00002; I_TPermIterat = 11; % h slow hMinSlow = 0.6602 - 0.002; hMaxslow = 0.6602 + 0.002; hSlowIterat = 11; % I_A Max I_AminConduct = 0.148092 - 0.00002; I_AmaxConduct = 0.148092 + 0.00002; I_AConductIterat = 11; % b slow bMinSlow = 8 - 3; bMaxSlow = 8 + 12; bSlowIterat = 11; % time stuff pulseBeginTime = 500; % Long enough for a bit of stabalization pulseLongDur = 4000; % Long enough for a lot of stabalization pulseShortDur = 400; % Not so long waitAtEnd = 2000; % Long enough for a long burst % Burst definition burst = 2; % a sim with at least this many spikes contains a burst % **************** I'll try to keep user input vars above here ********************************** % load the model open_system('/home/kevin/Lowpass.mdl'); % set parameters that aren't part of the search set_param('Lowpass/I_inj/pulse/begin', 'time', num2str(pulseBeginTime)); % loop through the given parameter space % make a counter i = 1; j = 1; for I_TPerm = linspace(I_TminPerm, I_TmaxPerm, I_TPermIterat) for hSlow = linspace(hMinSlow, hMaxslow, hSlowIterat) for I_AConduct = linspace(I_AminConduct, I_AmaxConduct, I_AConductIterat) for bSlow = linspace(bMinSlow, bMaxSlow, bSlowIterat) % set parameters to looping levels set_param('Lowpass/I_T/P_Ca', 'Value', num2str(I_TPerm)); set_param('Lowpass/I_T/Gates/h/slow', 'Value', num2str(hSlow)); set_param('Lowpass/I_A/gbarI_A', 'Value', num2str(I_AConduct)); set_param('Lowpass/I_A/Gates/b/slow', 'Value', num2str(bSlow)); % set hyperpol length to long set_param('Lowpass/I_inj/pulse/end', 'time', num2str(pulseBeginTime + pulseLongDur)); % run the model with the long hyperpolarization sim('Lowpass', pulseBeginTime + pulseLongDur + waitAtEnd); % test for a condition with no spikes if (size(spikes,1) == 0) % We have a condition where no spikes were recorded % set hyperpol length to short set_param('Lowpass/I_inj/pulse/end', 'time', num2str(pulseBeginTime + pulseShortDur)); % Rerun the simulation with a short hyperpolarization sim('Lowpass', pulseBeginTime + pulseShortDur + waitAtEnd); % test for condition with a burst if (size(spikes,1) >= burst) % We have a condition with a burst % record the parameters and the number of spikes conditions(i,:) = [I_TPerm hSlow I_AConduct bSlow length(spikes)]; % move to next line % and give the smallest of output i = i + 1; end % seccond run end % first run if mod(j,100) == 0 j end % if j = j + 1; end % bSlow loop end % I_AConduct loop end % hSlow loop end % I_TPerm loop save(['/home/kevin/conditions ',datestr(now),'.mat']); [min(conditions(:,1)), min(conditions(:,2)), min(conditions(:,3)),... min(conditions(:,4)), min(conditions(:,5));... max(conditions(:,1)), max(conditions(:,2)), max(conditions(:,3)),... max(conditions(:,4)), max(conditions(:,5))]