Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

loop in loop and plotting two data in a a same figure and then plotting frequency vs number of spikes

1 visualizzazione (ultimi 30 giorni)
hello all,
i am working on calcium inputs in a simbiology project file. i have a function of spikes as input for the model which has three varying variables: start time, frequency and number of spikes.
i managed to write a program for the different frequencies predicitng the output functions and same i did for max spikes seperately. now i wanted ro include both in one matlab code. and produce a graph like one attached.
this is my code:
----------------------------------------------------------------------------------------------------------------------------------
function Bito_like_prediction_freq_number()
proj=sbioloadproject('CaMKII_v3');
modelobj=proj.m1;
%startTime is time for relaxation
startTime=30;
stopTime=40;
times=0:0.01:stopTime;
frequencies=[0 2 3.3 5 6.7 10 20];
maxSpikeNum= [10 20 30];
max_step=0.005;
output_species=[6 12 33];
configsetObj = getconfigset(modelobj);
set(configsetObj, 'StopTime', times(end));
set(configsetObj, 'SolverType','ode15s');
set(configsetObj.SolverOptions, 'OutputTimes', times);
set(configsetObj.SolverOptions, 'MaxStep', max_step);
set(configsetObj.SolverOptions, 'AbsoluteTolerance', 1.0e-8);
set(configsetObj.SolverOptions, 'RelativeTolerance', 1.0e-6);
set(configsetObj.RuntimeOptions, 'StatesToLog', 'all');
% %set all initial amounts to 0
for ii=1:size(modelobj.species,1),
modelobj.species(ii).InitialAmount=0;
end
for ii=1:size(modelobj.Rules,1),
modelobj.Rules(ii).Active=1;
end
modelobj.species(1).InitialAmount=10000;
modelobj.Rules(49).Active=1;%Ca spiketrain
modelobj.Parameters(104).Value=startTime;
for i=1:length(frequencies)
if frequencies(i)>0
modelobj.Parameters(100).Value=frequencies(i);
for j=1:length(maxSpikeNum)
modelobj.Rules(49).Active=1;
modelobj.Parameters(107).Value=maxSpikeNum(j);
[t,y,names]=sbiosimulate(modelobj);
end
elseif frequencies(i)==0
for j=1:length(maxSpikeNum)
modelobj.Rules(49).Active=0;
modelobj.Parameters(107).Value=maxSpikeNum(j);
end
[t,y,names]=sbiosimulate(modelobj);
end
figure(1)
subplot(3,4,i)
plot(t(3000:end),y(3000:end,output_species))
legend(names{output_species(1)},names{output_species(2)}, names{output_species(3)})
title(num2str(frequencies(i)));
axis([30 35 0 7000])
figure(2)
subplot(1,3,j)
plot(t(3000:end),y(3000:end,output_species))
legend(names{output_species(1)},names{output_species(2)}, names{output_species(3)})
title(num2str(maxSpikeNum(j)));
axis([30 35 0 7000])
end
------------------------------------------------------------------------------------------------------------------------------
i know i am using a very wrong subplot it worked in individual cases but not for the kind of plot i wamt.
As, i understand i need to have each simulation in sim file saved with running simulation with each frequency for different spike numbers.
i am in kind of fix how to achieve that.
any help will be great.
thanks
Parul

Risposte (0)

Questa domanda è chiusa.

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by