Advertisement
SpaceQuester

Untitled

Nov 15th, 2023
1,090
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 120.99 KB | None | 0 0
  1. close all;
  2. clc;
  3. clear;
  4. warning('off', 'all');
  5.  
  6. FontSize = 16;
  7.  
  8. path1 = '/Users/sergeymakovkin/Documents/Fig_02_N_A_bifurc/n_step_0005';
  9.  
  10. filename1 = 'Data_SF_I_stim_V_max_V_min_nu.txt';
  11. Data   = importdata( [ path1 '/' filename1 ] );
  12. I_stim_SF    = Data(:, 1);
  13. V_max_SF = Data(:, 2);
  14. V_min_SF = Data(:, 3);
  15. nu_n_SF     = Data(:, 4);
  16. disp('Data_SF_I_stim_V_max_V_min_nu load complete');
  17.  
  18. filename1 = 'Data_LC_I_stim_V_max_V_min_nu.txt';
  19. Data   = importdata( [ path1 '/' filename1 ] );
  20. I_stim_LC    = Data(:, 1);
  21. V_max_LC = Data(:, 2);
  22. V_min_LC = Data(:, 3);
  23. nu_n_LC     = Data(:, 4);
  24. disp('Data_LC_I_stim_V_max_V_min_nu load complete');
  25.  
  26. path2 = '/Users/sergeymakovkin/Documents/Fig_02_N_A_bifurc/n_step_0005_back';
  27. filename2 = 'Data_LC_I_stim_V_max_V_min_nu_back.txt';
  28. Data_back   = importdata( [ path2 '/' filename2 ] );
  29. I_stim_back    = Data_back(:, 1);
  30. V_max_back = Data_back(:, 2);
  31. V_min_back = Data_back(:, 3);
  32. nu_n_back     = Data_back(:, 4);
  33. disp('Data_I_stim_V_max_V_min_back load complete');
  34.  
  35. path3 = '/Users/sergeymakovkin/Documents/Fig_02_N_A_bifurc/a_step_0005';
  36. filename3 = 'Data_SF_1_v_4_Ca_max_Ca_min_nu.txt';
  37. Data   = importdata( [ path3 '/' filename3 ] );
  38. v_4_SF_1    = Data(:, 1);
  39. Ca_max_SF_1 = Data(:, 2);
  40. Ca_min_SF_1 = Data(:, 3);
  41. nu_a_SF_1     = Data(:, 4);
  42. disp('Data_SF_1_v_4_Ca_max_Ca_min_nu load complete');
  43.  
  44. path4 = '/Users/sergeymakovkin/Documents/Fig_02_N_A_bifurc/a_step_0005';
  45. filename4 = 'Data_LC_1_v_4_Ca_max_Ca_min_nu.txt';
  46. Data   = importdata( [ path4 '/' filename4 ] );
  47. v_4_LC_1    = Data(:, 1);
  48. Ca_max_LC_1 = Data(:, 2);
  49. Ca_min_LC_1 = Data(:, 3);
  50. nu_a_LC_1     = Data(:, 4);
  51. disp('Data_LC_1_v_4_Ca_max_Ca_min_nu load complete');
  52.  
  53. path5 = '/Users/sergeymakovkin/Documents/Fig_02_N_A_bifurc/a_step_0005_back';
  54. filename5 = 'Data_SF_2_v_4_Ca_max_Ca_min_nu_back.txt';
  55. Data_back   = importdata( [ path5 '/' filename5 ] );
  56. v_4_back_SF_2    = Data_back(:, 1);
  57. Ca_max_back_SF_2 = Data_back(:, 2);
  58. Ca_min_back_SF_2 = Data_back(:, 3);
  59. nu_a_back_SF_2     = Data_back(:, 4);
  60. disp('Data_SF_2_v_4_Ca_max_Ca_min_back load complete');
  61.  
  62. path6 = '/Users/sergeymakovkin/Documents/Fig_02_N_A_bifurc/a_step_0005_back';
  63. filename6 = 'Data_LC_2_v_4_Ca_max_Ca_min_nu_back.txt';
  64. Data_back   = importdata( [ path6 '/' filename6 ] );
  65. v_4_back_LC_2    = Data_back(:, 1);
  66. Ca_max_back_LC_2 = Data_back(:, 2);
  67. Ca_min_back_LC_2 = Data_back(:, 3);
  68. nu_a_back_LC_2     = Data_back(:, 4);
  69. disp('Data_LC_2_v_4_Ca_max_Ca_min_back load complete');
  70.  
  71. results_neuro_astro_bifurc = figure('units', 'normalized', 'outerposition', [0 0 0.8 1], 'visible', 'on');
  72. sp221 = subplot(2, 2, 1);
  73. plot(I_stim_SF, V_max_SF, 'g-', 'LineWidth', 2);
  74. hold on;
  75. plot(I_stim_SF, V_min_SF, 'g-', 'LineWidth', 2);
  76. hold on;
  77.  
  78. plot(I_stim_LC, V_max_LC, 'r-', 'LineWidth', 2);
  79. hold on;
  80. plot(I_stim_LC, V_min_LC, 'r-', 'LineWidth', 2);
  81. hold on;
  82.  
  83. plot(I_stim_back, V_max_back, 'b-', 'LineWidth', 2);
  84. hold on;
  85. plot(I_stim_back, V_min_back, 'b-', 'LineWidth', 2);
  86. hold on;
  87.  
  88. %grid on;
  89. box on;
  90. %pbaspect([1 1 1]);
  91. xlim([0 2.0]);
  92. ylim([-80 20]);
  93. ax = gca;
  94. ax.XTick = [0: 0.5: 2.0];
  95. xtickformat('%1.1f');
  96. ax.YTick = [-80: 20: 20];
  97. ytickformat('%.0f');
  98. %yticklabels({'0', '\pi/2', '\pi', '3\pi/2', '2\pi'});
  99. %yticklabels({'0', '\pi/4', '\pi/2', '3\pi/4', '\pi', '5\pi/4', '3\pi/2', '7\pi/4', '2\pi'});
  100. %legend('<\nu_i>');
  101. %xlabel('I_{stim}, \muA/cm^{2}', 'FontSize', FontSize);
  102. ylabel('V, mV', 'FontSize', FontSize);
  103. title('a)', 'FontSize', FontSize);
  104. set(gca, 'FontSize', FontSize);
  105.  
  106. sp223 = subplot(2, 2, 3);
  107. plot(I_stim_SF, nu_n_SF, 'g-', 'LineWidth', 2);
  108. hold on;
  109.  
  110. plot(I_stim_LC, nu_n_LC, 'r-', 'LineWidth', 2);
  111. hold on;
  112.  
  113. plot(I_stim_back, nu_n_back, 'b-', 'LineWidth', 2);
  114. hold on;
  115.  
  116. x_start_1 = 1.08;
  117. x_end_1   = 1.08;
  118. y_start_1 = 7;
  119. y_end_1   = 16;
  120. RedArrow = annotation('arrow');
  121. RedArrow.Parent = gca;
  122. RedArrow.X = [x_start_1, x_end_1];
  123. RedArrow.Y = [y_start_1, y_end_1];
  124. RedArrow.Color = 'red';
  125. hold on;
  126.  
  127. x_start_2 = 0.78;
  128. x_end_2   = 0.78;
  129. y_start_2 = 11.5;
  130. y_end_2   = 2.5;
  131. BlueArrow = annotation('arrow');
  132. BlueArrow.Parent = gca;
  133. BlueArrow.X = [x_start_2, x_end_2];
  134. BlueArrow.Y = [y_start_2, y_end_2];
  135. BlueArrow.Color = 'blue';
  136. hold on;
  137.  
  138. %grid on;
  139. box on;
  140. xlim([0 2.0]);
  141. ylim([0 40]);
  142. ax = gca;
  143. ax.XTick = [0: 0.5: 2.0];
  144. xtickformat('%.1f');
  145. ax.YTick = [0: 10: 40];
  146. ytickformat('%.0f');
  147. %yticklabels({'0', '\pi/2', '\pi', '3\pi/2', '2\pi'});
  148. %yticklabels({'0', '\pi/4', '\pi/2', '3\pi/4', '\pi', '5\pi/4', '3\pi/2', '7\pi/4', '2\pi'});
  149. %legend('<\nu_i>');
  150. xlabel('I_{stim}, \muA/cm^{2}', 'FontSize', FontSize);
  151. ylabel('\nu, s^{-1}', 'FontSize', FontSize);
  152. title('b)', 'FontSize', FontSize);
  153. set(gca, 'FontSize', FontSize);
  154.  
  155. sp222 = subplot(2, 2, 2);
  156. plot(v_4_SF_1, Ca_max_SF_1, 'g-', 'LineWidth', 2);
  157. hold on;
  158. plot(v_4_SF_1, Ca_min_SF_1, 'g-', 'LineWidth', 2);
  159. hold on;
  160.  
  161. plot(v_4_back_SF_2, Ca_max_back_SF_2, 'g-', 'LineWidth', 2);
  162. hold on;
  163. plot(v_4_back_SF_2, Ca_min_back_SF_2, 'g-', 'LineWidth', 2);
  164. hold on;
  165.  
  166. plot(v_4_LC_1, Ca_max_LC_1, 'r-', 'LineWidth', 2);
  167. hold on;
  168. plot(v_4_LC_1, Ca_min_LC_1, 'r-', 'LineWidth', 2);
  169. hold on;
  170.  
  171. plot(v_4_back_LC_2, Ca_max_back_LC_2, 'b-', 'LineWidth', 2);
  172. hold on;
  173. plot(v_4_back_LC_2, Ca_min_back_LC_2, 'b-', 'LineWidth', 2);
  174. hold on;
  175.  
  176. %grid on;
  177. box on;
  178. xlim([0 2.5]);
  179. ylim([0 0.7]);
  180. ax = gca;
  181. ax.XTick = [0: 0.5: 2.5];
  182. xtickformat('%.1f');
  183. ax.YTick = [0: 0.1: 0.7];
  184. ytickformat('%.1f');
  185. %yticklabels({'0', '\pi/2', '\pi', '3\pi/2', '2\pi'});
  186. %yticklabels({'0', '\pi/4', '\pi/2', '3\pi/4', '\pi', '5\pi/4', '3\pi/2', '7\pi/4', '2\pi'});
  187. %legend('<\nu_i>');
  188. %xlabel('v_{4}, \muM/s', 'FontSize', FontSize);
  189. ylabel('[Ca^{2+}], \muM', 'FontSize', FontSize);
  190. title('c)', 'FontSize', FontSize);
  191. set(gca, 'FontSize', FontSize);
  192.  
  193. sp224 = subplot(2, 2, 4);
  194. plot(v_4_SF_1, nu_a_SF_1, 'g-', 'LineWidth', 2);
  195. hold on;
  196.  
  197. plot(v_4_back_SF_2, nu_a_back_SF_2, 'g-', 'LineWidth', 2);
  198. hold on;
  199.  
  200. plot(v_4_LC_1, nu_a_LC_1, 'r-', 'LineWidth', 2);
  201. hold on;
  202.  
  203. plot(v_4_back_LC_2, nu_a_back_LC_2, 'b-', 'LineWidth', 2);
  204. hold on;
  205.  
  206. x_start_12 = 2.13;
  207. x_end_12   = 2.13;
  208. y_start_12 = 0.08;
  209. y_end_12   = 0.02;
  210. RedArrow2 = annotation('arrow');
  211. RedArrow2.Parent = gca;
  212. RedArrow2.X = [x_start_12, x_end_12];
  213. RedArrow2.Y = [y_start_12, y_end_12];
  214. RedArrow2.Color = 'red';
  215. hold on;
  216.  
  217. x_start_22 = 1.73;
  218. x_end_22   = 1.73;
  219. y_start_22 = 0.02;
  220. y_end_22   = 0.08;
  221. BlueArrow2 = annotation('arrow');
  222. BlueArrow2.Parent = gca;
  223. BlueArrow2.X = [x_start_22, x_end_22];
  224. BlueArrow2.Y = [y_start_22, y_end_22];
  225. BlueArrow2.Color = 'blue';
  226.  
  227. %grid on;
  228. box on;
  229. xlim([0 2.5]);
  230. ylim([0 0.15]);
  231. ax = gca;
  232. ax.XTick = [0: 0.5: 2.5];
  233. xtickformat('%.1f');
  234. ax.YTick = [0: 0.025: 0.15];
  235. ytickformat('%.3f');
  236. %yticklabels({'0', '\pi/2', '\pi', '3\pi/2', '2\pi'});
  237. %yticklabels({'0', '\pi/4', '\pi/2', '3\pi/4', '\pi', '5\pi/4', '3\pi/2', '7\pi/4', '2\pi'});
  238. %legend('<\nu_i>');
  239. xlabel('v_4, \muM/s', 'FontSize', FontSize);
  240. ylabel('\nu, s^{-1}', 'FontSize', FontSize);
  241. title('d)', 'FontSize', FontSize);
  242. set(gca, 'FontSize', FontSize);
  243.  
  244. saveas(gcf, 'results_neuro_astro_bifurc.png');
  245. saveas(gcf, 'results_neuro_astro_bifurc', 'epsc');
  246. close(results_neuro_astro_bifurc);
  247. disp('Picture results_neuro_astro_bifurc save');
  248.  
  249. return
  250.  
  251. %{
  252. path1 = '/home/makovkin_s/HH_Recogn_2023_03_01_4x1_RN_SN_IN_CN_E_syn_IN_phi_CN_RN_steps_500_1';
  253. %path1 = '/Users/sergeymakovkin/Documents/HH_Recogn_2022_11_21_1x1_4th_Excitation_Phase'; FontSize = 20;
  254.  
  255. filename1 = 'Data_E_syn_IN_phi_CN_RN.txt';
  256. Data = importdata( [ path1 '/' filename1 ] );
  257. V_syn_IN_1    = Data(:, 1);
  258. Phase_CN_RN_1 = Data(:, 2);
  259. disp('Data_E_syn_IN_phi_CN_RN 1 load complete');
  260.  
  261. path1 = '/home/makovkin_s/HH_Recogn_2023_03_01_4x1_RN_SN_IN_CN_E_syn_IN_phi_CN_RN_steps_500_2';
  262. %path1 = '/Users/sergeymakovkin/Documents/HH_Recogn_2022_11_21_1x1_4th_Excitation_Phase'; FontSize = 20;
  263.  
  264. filename1 = 'Data_E_syn_IN_phi_CN_RN.txt';
  265. Data = importdata( [ path1 '/' filename1 ] );
  266. V_syn_IN_2    = Data(:, 1);
  267. Phase_CN_RN_2 = Data(:, 2);
  268. disp('Data_E_syn_IN_phi_CN_RN 2 load complete');
  269.  
  270. path1 = '/home/makovkin_s/HH_Recogn_2023_03_01_4x1_RN_SN_IN_CN_E_syn_IN_phi_CN_RN_steps_500_3';
  271. %path1 = '/Users/sergeymakovkin/Documents/HH_Recogn_2022_11_21_1x1_4th_Excitation_Phase'; FontSize = 20;
  272.  
  273. filename1 = 'Data_E_syn_IN_phi_CN_RN.txt';
  274. Data = importdata( [ path1 '/' filename1 ] );
  275. V_syn_IN_3    = Data(:, 1);
  276. Phase_CN_RN_3 = Data(:, 2);
  277. disp('Data_E_syn_IN_phi_CN_RN 3 load complete');
  278.  
  279. path1 = '/home/makovkin_s/HH_Recogn_2023_03_01_4x1_RN_SN_IN_CN_E_syn_IN_phi_CN_RN_steps_500_4';
  280. %path1 = '/Users/sergeymakovkin/Documents/HH_Recogn_2022_11_21_1x1_4th_Excitation_Phase'; FontSize = 20;
  281.  
  282. filename1 = 'Data_E_syn_IN_phi_CN_RN.txt';
  283. Data = importdata( [ path1 '/' filename1 ] );
  284. V_syn_IN_4    = Data(:, 1);
  285. Phase_CN_RN_4 = Data(:, 2);
  286. disp('Data_E_syn_IN_phi_CN_RN 4 load complete');
  287. %}
  288.  
  289. results_Phase_CN_RN_V_syn_SN = figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  290. %plot(V_syn_IN, Phase_CN_RN,  '.', 'LineWidth', 2);
  291. plot(V_syn_SN, Phase_CN_RN,  'k.', 'MarkerSize', 6);
  292. hold on;
  293. %{
  294. plot(V_syn_IN_1, Phase_CN_RN_1,  'k.', 'MarkerSize', 6);
  295. hold on;
  296. plot(V_syn_IN_2, Phase_CN_RN_2,  'k.', 'MarkerSize', 6);
  297. hold on;
  298. plot(V_syn_IN_3, Phase_CN_RN_3,  'k.', 'MarkerSize', 6);
  299. hold on;
  300. plot(V_syn_IN_4, Phase_CN_RN_4,  'k.', 'MarkerSize', 6);
  301. hold on;
  302. %}
  303. grid on;
  304. box on;
  305. %xlim([-73 -69]);
  306. xlim([-90 0]);
  307. %ylim([3*pi/2 2*pi]);
  308. ylim([0 2*pi]);
  309. ax = gca;
  310. %ax.XTick = [-80: 1: 65];
  311. ax.XTick = [-90: 5: 0];
  312. xtickformat('%.0f');
  313. %ax.YTick = [0: pi/2: 2*pi];
  314. ax.YTick = [0: pi/4: 2*pi];
  315. %ytickformat('%.2f');
  316. %yticklabels({'0', '\pi/2', '\pi', '3\pi/2', '2\pi'});
  317. yticklabels({'0', '\pi/4', '\pi/2', '3\pi/4', '\pi', '5\pi/4', '3\pi/2', '7\pi/4', '2\pi'});
  318. %legend('<\nu_i>');
  319. xlabel('V_{syn SN eff}, mV', 'FontSize', FontSize);
  320. ylabel('\Delta\phi_{V_{CN}-V_{RN}}', 'FontSize', FontSize);
  321. title('\Delta\phi between V_{CN} and V_{RN}', 'FontSize', FontSize);
  322. set(gca, 'FontSize', FontSize);
  323.  
  324. saveas(gcf, 'results_Phase_CN_RN_V_syn_SN.png');
  325. %saveas(gcf, 'results_Phase_CN_RN_V_syn_SN', 'epsc');
  326. close(results_Phase_CN_RN_V_syn_SN);
  327. disp('Picture results_Phase_CN_RN_V_syn_SN save');
  328.  
  329. return
  330.  
  331. Data_Delta_Phi_CN_RN_E_syn_IN = [phi_new_CN_RN(end), E_syn_IN];
  332. formatSpec = '%2.4f\t%2.4f\n';
  333. fileID = fopen('Data_Delta_Phi_CN_RN_E_syn_IN.txt', 'A');
  334. fprintf(fileID, formatSpec, Data_Delta_Phi_CN_RN_E_syn_IN');
  335. fclose(fileID);
  336.  
  337. return
  338.  
  339. %{
  340. %%%%%%%%%%%%%%
  341. omega_cur = 0;
  342. omega_total = [];
  343. yyaxis left;
  344. regular_V_spiking_counter = 0;
  345. %for i = 1:size(V, 2)
  346. i = 2;
  347.     V_p = V(:, i);
  348.     [pks, locs] = findpeaks(V_p, 'MinPeakHeight', -10);
  349.    
  350.     for pks_counter = 1:size(pks, 1)
  351.         pks(pks_counter) = i;
  352.     end
  353.  
  354.     if isempty([pks, locs]) || size(pks, 1) == 1
  355.         omega_cur = 0;
  356.         omega_total = [omega_total omega_cur'];
  357.         %plot(omega_cur, i, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  358.         %hold on;
  359.     end
  360.     if ~isempty([pks, locs]) && size(pks, 1) ~= 1
  361.         regular_V_spiking_counter = regular_V_spiking_counter + 1;
  362.         omega_cur = 1./diff(time_V(locs));
  363.         omega_total = [omega_total omega_cur'];
  364.         %plot(omega_cur, pks(2:end), 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  365.         %hold on;
  366.     end
  367. %end
  368. time_locs_2 = time_V(locs);
  369. omega_cur_2 = omega_cur;
  370.  
  371. state_2 = 0;
  372.  
  373. if size(time_locs_2, 1) >= 1
  374.     state_2 = 1;
  375. else state_2 == 0;
  376. end
  377. %}
  378.  
  379. Data_I_app_IN_g_syn_SN_freq_IN = [I_app_3, g_syn_2, freq_3];
  380. formatSpec = '%2.4f\t%2.4f\t%2.4f\n';
  381. fileID = fopen('Data_I_app_IN_g_syn_SN_freq_IN.txt','A');
  382. fprintf(fileID, formatSpec, Data_I_app_IN_g_syn_SN_freq_IN');
  383. fclose(fileID);
  384.  
  385. return
  386.  
  387. Data_2 = [time_locs_2(2:end), omega_cur_2];
  388. formatSpec = '%2.4f %2.4f\n';
  389. fileID = fopen('Data_2.txt','w');
  390. fprintf(fileID, formatSpec, Data_2');
  391. fclose(fileID);
  392.  
  393. return
  394.  
  395. %%%%%%%%%%%%%%%%%%%%%%%% Phases Begin %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  396. omega_cur = 0;
  397. omega_total = [];
  398. yyaxis left;
  399. regular_V_spiking_counter = 0;
  400. %for i = 1:size(V, 2)
  401. i = 1;
  402.     V_p = V(:, i);
  403.     [pks, locs] = findpeaks(V_p, 'MinPeakHeight', -10);
  404.    
  405.     for pks_counter = 1:size(pks, 1)
  406.         pks(pks_counter) = i;
  407.     end
  408.  
  409.     if isempty([pks, locs]) || size(pks, 1) == 1
  410.         omega_cur = 0;
  411.         omega_total = [omega_total omega_cur'];
  412.         %plot(omega_cur, i, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  413.         %hold on;
  414.     end
  415.     if ~isempty([pks, locs]) && size(pks, 1) ~= 1
  416.         regular_V_spiking_counter = regular_V_spiking_counter + 1;
  417.         omega_cur = 1./diff(time_V(locs));
  418.         omega_total = [omega_total omega_cur'];
  419.         %plot(omega_cur, pks(2:end), 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  420.         %hold on;
  421.     end
  422. %end
  423. time_locs_1 = time_V(locs);
  424. omega_cur_1 = omega_cur;
  425.  
  426. Data_1 = [time_locs_1(2:end), omega_cur_1];
  427. formatSpec = '%2.4f %2.4f\n';
  428. fileID = fopen('Data_1.txt','w');
  429. fprintf(fileID, formatSpec, Data_1');
  430. fclose(fileID);
  431. %%%%%%%%%%%%%%%%%
  432.  
  433. omega_cur = 0;
  434. omega_total = [];
  435. yyaxis left;
  436. regular_V_spiking_counter = 0;
  437. %for i = 1:size(V, 2)
  438. i = 2;
  439.     V_p = V(:, i);
  440.     [pks, locs] = findpeaks(V_p, 'MinPeakHeight', -10);
  441.    
  442.     for pks_counter = 1:size(pks, 1)
  443.         pks(pks_counter) = i;
  444.     end
  445.  
  446.     if isempty([pks, locs]) || size(pks, 1) == 1
  447.         omega_cur = 0;
  448.         omega_total = [omega_total omega_cur'];
  449.         %plot(omega_cur, i, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  450.         %hold on;
  451.     end
  452.     if ~isempty([pks, locs]) && size(pks, 1) ~= 1
  453.         regular_V_spiking_counter = regular_V_spiking_counter + 1;
  454.         omega_cur = 1./diff(time_V(locs));
  455.         omega_total = [omega_total omega_cur'];
  456.         %plot(omega_cur, pks(2:end), 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  457.         %hold on;
  458.     end
  459. %end
  460. time_locs_2 = time_V(locs);
  461. omega_cur_2 = omega_cur;
  462.  
  463. Data_2 = [time_locs_2(2:end), omega_cur_2];
  464. formatSpec = '%2.4f %2.4f\n';
  465. fileID = fopen('Data_2.txt','w');
  466. fprintf(fileID, formatSpec, Data_2');
  467. fclose(fileID);
  468. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  469.  
  470. omega_cur = 0;
  471. omega_total = [];
  472. yyaxis left;
  473. regular_V_spiking_counter = 0;
  474. %for i = 1:size(V, 2)
  475. i = 3;
  476.     V_p = V(:, i);
  477.     [pks, locs] = findpeaks(V_p, 'MinPeakHeight', -10);
  478.    
  479.     for pks_counter = 1:size(pks, 1)
  480.         pks(pks_counter) = i;
  481.     end
  482.  
  483.     if isempty([pks, locs]) || size(pks, 1) == 1
  484.         omega_cur = 0;
  485.         omega_total = [omega_total omega_cur'];
  486.         %plot(omega_cur, i, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  487.         %hold on;
  488.     end
  489.     if ~isempty([pks, locs]) && size(pks, 1) ~= 1
  490.         regular_V_spiking_counter = regular_V_spiking_counter + 1;
  491.         omega_cur = 1./diff(time_V(locs));
  492.         omega_total = [omega_total omega_cur'];
  493.         %plot(omega_cur, pks(2:end), 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  494.         %hold on;
  495.     end
  496. %end
  497. time_locs_3 = time_V(locs);
  498. omega_cur_3 = omega_cur;
  499.  
  500. Data_3 = [time_locs_3(2:end), omega_cur_3];
  501. formatSpec = '%2.4f %2.4f\n';
  502. fileID = fopen('Data_3.txt','w');
  503. fprintf(fileID, formatSpec, Data_3');
  504. fclose(fileID);
  505. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  506.  
  507. omega_cur = 0;
  508. omega_total = [];
  509. yyaxis left;
  510. regular_V_spiking_counter = 0;
  511. %for i = 1:size(V, 2)
  512. i = 4;
  513.     V_p = V(:, i);
  514.     [pks, locs] = findpeaks(V_p, 'MinPeakHeight', -10);
  515.    
  516.     for pks_counter = 1:size(pks, 1)
  517.         pks(pks_counter) = i;
  518.     end
  519.  
  520.     if isempty([pks, locs]) || size(pks, 1) == 1
  521.         omega_cur = 0;
  522.         omega_total = [omega_total omega_cur'];
  523.         %plot(omega_cur, i, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  524.         %hold on;
  525.     end
  526.     if ~isempty([pks, locs]) && size(pks, 1) ~= 1
  527.         regular_V_spiking_counter = regular_V_spiking_counter + 1;
  528.         omega_cur = 1./diff(time_V(locs));
  529.         omega_total = [omega_total omega_cur'];
  530.         %plot(omega_cur, pks(2:end), 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  531.         %hold on;
  532.     end
  533. %end
  534. time_locs_4 = time_V(locs);
  535. omega_cur_4 = omega_cur;
  536.  
  537. Data_4 = [time_locs_4(2:end), omega_cur_4];
  538. formatSpec = '%2.4f %2.4f\n';
  539. fileID = fopen('Data_4.txt','w');
  540. fprintf(fileID, formatSpec, Data_4');
  541. fclose(fileID);
  542. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  543.  
  544. results_freq_phase_phi_1_2 = figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  545. subplot(2, 1, 1);
  546. plot(time_locs_1(2:end), omega_cur_1,  '.', 'LineWidth', 2);
  547. hold on;
  548. plot(time_locs_2(2:end), omega_cur_2,  '.', 'LineWidth', 2);
  549. set(gca, 'FontSize', FontSize);
  550. grid on;
  551. xlim([time_Debug_begin time_Debug_end]);
  552. ylim([freq_min freq_max]);
  553. ax = gca;
  554. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  555. legend('\nu_1', '\nu_2');
  556. xlabel('Time, sec', 'FontSize', FontSize);
  557. ylabel('\nu, sec^{-1}', 'FontSize', FontSize);
  558. title('\nu_1, \nu_2', 'FontSize', FontSize);
  559.  
  560. min_time_size_RN_SN = min(size(time_locs_1, 1), size(time_locs_2, 1));
  561. max_per_RN_SN = max(max(diff(time_locs_1)), max(diff(time_locs_2)));
  562. phi_RN_SN = 2*pi*(time_locs_1(1:min_time_size_RN_SN) - time_locs_2(1:min_time_size_RN_SN)) / max_per_RN_SN;
  563. phi_1_2_mean = mod(phi_RN_SN, 2*pi);
  564. phi_1_2_mean = phi_1_2_mean(round(end/2): end, :);
  565. phi_1_2_mean = mean(phi_1_2_mean);
  566.  
  567. Data_Phase_1_2 = [E_syn, phi_1_2_mean];
  568. formatSpec = '%2.4f %2.4f\n';
  569. fileID = fopen('Data_Phase_1_2.txt','a');
  570. fprintf(fileID, formatSpec, Data_Phase_1_2');
  571. fclose(fileID);
  572.  
  573. %figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  574. subplot(2, 1, 2)
  575. plot(time_locs_2(1:min_time_size_RN_SN), mod(phi_RN_SN, 2*pi), '.', 'LineWidth', 3);
  576. set(gca, 'FontSize', FontSize);
  577. grid on;
  578. xlim([time_Debug_begin time_Debug_end]);
  579. ylim([0 2*pi]);
  580. ax = gca;
  581. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  582. yticks([0, pi/2, pi, 3*pi/2, 2*pi])
  583. yticklabels({'0','\pi/2','\pi','3/2 \pi','2 \pi'})
  584. xlabel('Time, sec', 'FontSize', FontSize);
  585. ylabel('\Delta \phi_{1, 2}, rad', 'FontSize', FontSize);
  586. title('\Delta \phi_{1, 2}', 'FontSize', FontSize);
  587.  
  588. saveas(gcf, 'results_freq_phase_phi_1_2.png');
  589. %saveas(gcf, 'results_freq_phase_phi_1_2', 'epsc');
  590. close(results_freq_phase_phi_1_2);
  591. disp('results_freq_phase_phi_1_2 save');
  592.  
  593. results_freq_phase_phi_1_3 = figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  594. subplot(2, 1, 1);
  595. plot(time_locs_1(2:end), omega_cur_1,  '.', 'LineWidth', 2);
  596. hold on;
  597. plot(time_locs_3(2:end), omega_cur_3,  '.', 'LineWidth', 2);
  598. set(gca, 'FontSize', FontSize);
  599. grid on;
  600. xlim([time_Debug_begin time_Debug_end]);
  601. ylim([freq_min freq_max]);
  602. ax = gca;
  603. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  604. legend('\nu_1', '\nu_3');
  605. xlabel('Time, sec', 'FontSize', FontSize);
  606. ylabel('\nu, sec^{-1}', 'FontSize', FontSize);
  607. title('\nu_1, \nu_3', 'FontSize', FontSize);
  608.  
  609. min_time_size_1_3 = min(size(time_locs_1, 1), size(time_locs_3, 1));
  610. max_per_1_3 = max(max(diff(time_locs_1)), max(diff(time_locs_3)));
  611. phi_1_3 = 2*pi*(time_locs_1(1:min_time_size_1_3) - time_locs_3(1:min_time_size_1_3)) / max_per_1_3;
  612. phi_1_3_mean = mod(phi_1_3, 2*pi);
  613. phi_1_3_mean = phi_1_3_mean(round(end/2): end, :);
  614. phi_1_3_mean = mean(phi_1_3_mean);
  615.  
  616. Data_Phase_1_3 = [E_syn, phi_1_3_mean];
  617. formatSpec = '%2.4f %2.4f\n';
  618. fileID = fopen('Data_Phase_1_3.txt','a');
  619. fprintf(fileID, formatSpec, Data_Phase_1_3');
  620. fclose(fileID);
  621.  
  622. %figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  623. subplot(2, 1, 2)
  624. plot(time_locs_3(1:min_time_size_1_3), mod(phi_1_3, 2*pi), '.', 'LineWidth', 3);
  625. set(gca, 'FontSize', FontSize);
  626. grid on;
  627. xlim([time_Debug_begin time_Debug_end]);
  628. ylim([0 2*pi]);
  629. ax = gca;
  630. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  631. yticks([0, pi/2, pi, 3*pi/2, 2*pi])
  632. yticklabels({'0','\pi/2','\pi','3/2 \pi','2 \pi'})
  633. xlabel('Time, sec', 'FontSize', FontSize);
  634. ylabel('\Delta \phi_{1, 3}, rad', 'FontSize', FontSize);
  635. title('\Delta \phi_{1, 3}', 'FontSize', FontSize);
  636.  
  637. saveas(gcf, 'results_freq_phase_phi_1_3.png');
  638. %saveas(gcf, 'results_freq_phase_phi_1_3', 'epsc');
  639. close(results_freq_phase_phi_1_3);
  640. disp('results_freq_phase_phi_1_3 save');
  641.  
  642. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  643.  
  644. results_freq_phase_phi_1_4 = figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  645. subplot(2, 1, 1);
  646. plot(time_locs_1(2:end), omega_cur_1,  '.', 'LineWidth', 2);
  647. hold on;
  648. plot(time_locs_4(2:end), omega_cur_4,  '.', 'LineWidth', 2);
  649. set(gca, 'FontSize', FontSize);
  650. grid on;
  651. xlim([time_Debug_begin time_Debug_end]);
  652. ylim([freq_min freq_max]);
  653. ax = gca;
  654. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  655. legend('\nu_1', '\nu_4');
  656. xlabel('Time, sec', 'FontSize', FontSize);
  657. ylabel('\nu, sec^{-1}', 'FontSize', FontSize);
  658. title('\nu_1, \nu_4', 'FontSize', FontSize);
  659.  
  660. min_time_size_1_4 = min(size(time_locs_1, 1), size(time_locs_4, 1));
  661. max_per_1_4 = max(max(diff(time_locs_1)), max(diff(time_locs_4)));
  662. phi_1_4 = 2*pi*(time_locs_1(1:min_time_size_1_4) - time_locs_4(1:min_time_size_1_4)) / max_per_1_4;
  663. phi_1_4_mean = mod(phi_1_4, 2*pi);
  664. phi_1_4_mean = phi_1_4_mean(round(end/2): end, :);
  665. phi_1_4_mean = mean(phi_1_4_mean);
  666.  
  667. Data_Phase_1_4 = [E_syn, phi_1_4_mean];
  668. formatSpec = '%2.4f %2.4f\n';
  669. fileID = fopen('Data_Phase_1_4.txt','a');
  670. fprintf(fileID, formatSpec, Data_Phase_1_4');
  671. fclose(fileID);
  672.  
  673. %figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  674. subplot(2, 1, 2)
  675. plot(time_locs_4(1:min_time_size_1_4), mod(phi_1_4, 2*pi), '.', 'LineWidth', 3);
  676. set(gca, 'FontSize', FontSize);
  677. grid on;
  678. xlim([time_Debug_begin time_Debug_end]);
  679. ylim([0 2*pi]);
  680. ax = gca;
  681. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  682. yticks([0, pi/2, pi, 3*pi/2, 2*pi])
  683. yticklabels({'0','\pi/2','\pi','3/2 \pi','2 \pi'})
  684. xlabel('Time, sec', 'FontSize', FontSize);
  685. ylabel('\Delta \phi_{1, 4}, rad', 'FontSize', FontSize);
  686. title('\Delta \phi_{1, 4}', 'FontSize', FontSize);
  687.  
  688. saveas(gcf, 'results_freq_phase_phi_1_4.png');
  689. %saveas(gcf, 'results_freq_phase_phi_1_4', 'epsc');
  690. close(results_freq_phase_phi_1_4);
  691. disp('results_freq_phase_phi_1_4 save');
  692. %%%%%%%%%%%%%%%%%%%%%%%% Phases End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  693.  
  694. results_V_I_stim_I_syn_nu_phase_Recogn_4 = figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  695.  
  696. subplot(4, 5, 1);
  697. plot(time_V, V(:, 1), 'LineWidth', 1);
  698. grid on;
  699. xlim([time_Debug_begin time_Debug_end]);
  700. ylim([-80 40]);
  701. ax = gca;
  702. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  703. xtickformat(xtckfrmt);
  704. %xlabel('Time, s', 'FontSize', FontSize);
  705. ylabel('V, mV', 'FontSize', FontSize);
  706. title(['V(t) for ', num2str(1), '^{st} neuron'], 'FontSize', FontSize);
  707. set(gca, 'FontSize', FontSize);
  708.  
  709. subplot(4, 5, 2);
  710. plot(time_I_stim, I_stim_SF(:, 1), 'LineWidth', 1);
  711. grid on;
  712. xlim([time_Debug_begin time_Debug_end]);
  713. ylim([0.0 I_stim_max]);
  714. ax = gca;
  715. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  716. xtickformat(xtckfrmt);
  717. %xlabel('Time, s', 'FontSize', FontSize);
  718. ylabel('I_{stim}, \muA/cm^2', 'FontSize', FontSize);
  719. title(['I_{stim}(t) for ', num2str(1), '^{st} neuron'], 'FontSize', FontSize);
  720. set(gca, 'FontSize', FontSize);
  721.  
  722. subplot(4, 5, 3);
  723. plot(time_I_syn, I_syn(:, 1), 'LineWidth', 1);
  724. grid on;
  725. xlim([time_Debug_begin time_Debug_end]);
  726. ylim([0.0 10]);
  727. ax = gca;
  728. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  729. xtickformat(xtckfrmt);
  730. %xlabel('Time, s', 'FontSize', FontSize);
  731. ylabel('I_{syn}, \muA/cm^2', 'FontSize', FontSize);
  732. title(['I_{syn}(t) for ', num2str(1), '^{st} neuron'], 'FontSize', FontSize);
  733. set(gca, 'FontSize', FontSize);
  734. %%%%%%%%%
  735.  
  736. subplot(4, 5, 4);
  737. omega_cur = 0;
  738. omega_total = [];
  739. time_total = [];
  740. %yyaxis left;
  741. regular_V_spiking_counter = 0;
  742. %for i = 1:size(V, 2)
  743. i = 1;
  744.     V_p = V(:, i);
  745.     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  746.    
  747.     for pks_counter = 1:size(pks, 1)
  748.         pks(pks_counter) = i;
  749.     end
  750.  
  751.     if isempty([pks, locs]) || size(pks, 1) == 1
  752.         omega_cur = 0;
  753.         omega_total = [omega_total omega_cur'];
  754.         time_locs = locs;
  755.         time_locs = time_locs(2:end);
  756.         %time_locs = time_locs(find(omega_cur'<=60));
  757.         time_total = [time_total time_locs'];
  758.         %plot(omega_cur, i, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  759.         %hold on;
  760.     end
  761.     if ~isempty([pks, locs]) && size(pks, 1) > 1
  762.         regular_V_spiking_counter = regular_V_spiking_counter + 1;
  763.         omega_cur = 1./diff(locs);
  764.         %omega_cur = omega_cur(find(omega_cur'<=60));
  765.         omega_total = [omega_total omega_cur'];
  766.         time_locs = locs;
  767.         time_locs = time_locs(2:end);
  768.         %time_locs = time_locs(find(omega_cur'<=60));
  769.         time_total = [time_total time_locs'];
  770.         %plot(omega_cur, pks(2:end), 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  771.         %hold on;
  772.     end
  773.    
  774.     if ~isempty([pks, locs]) && size(pks, 1) > 1
  775.         plot(time_locs, omega_cur,  '-', 'LineWidth', 1);
  776.         hold on;
  777.     end
  778. %end
  779.  
  780. set(gca, 'FontSize', FontSize);
  781. grid on;
  782. box on;
  783. xlim([time_Debug_begin time_Debug_end]);
  784. ylim([freq_min freq_max]);
  785. ax = gca;
  786. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  787. xtickformat(xtckfrmt);
  788. ax.YTick = [freq_min: d_freq: freq_max];
  789. %legend('<\nu_i>');
  790. %xlabel('Time, sec', 'FontSize', FontSize);
  791. ylabel('\nu, s^{-1}', 'FontSize', FontSize);
  792. title([num2str(1), '^{st} neuron frequencies'], 'FontSize', FontSize);
  793.  
  794. %%%%%%%%%
  795. subplot(4, 5, 6);
  796. plot(time_V, V(:, 2), 'LineWidth', 1);
  797. grid on;
  798. xlim([time_Debug_begin time_Debug_end]);
  799. ylim([-80 40]);
  800. ax = gca;
  801. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  802. xtickformat(xtckfrmt);
  803. %xlabel('Time, s', 'FontSize', FontSize);
  804. ylabel('V, mV', 'FontSize', FontSize);
  805. title(['V(t) for ', num2str(2), '^{nd} neuron'], 'FontSize', FontSize);
  806. set(gca, 'FontSize', FontSize);
  807.  
  808. subplot(4, 5, 7);
  809. plot(time_I_stim, I_stim_SF(:, 2), 'LineWidth', 1);
  810. grid on;
  811. xlim([time_Debug_begin time_Debug_end]);
  812. ylim([0.0 I_stim_max]);
  813. ax = gca;
  814. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  815. xtickformat(xtckfrmt);
  816. %xlabel('Time, s', 'FontSize', FontSize);
  817. ylabel('I_{stim}, \muA/cm^2', 'FontSize', FontSize);
  818. title(['I_{stim}(t) for ', num2str(2), '^{nd} neuron'], 'FontSize', FontSize);
  819. set(gca, 'FontSize', FontSize);
  820.  
  821. subplot(4, 5, 8);
  822. plot(time_I_syn, I_syn(:, 2), 'LineWidth', 1);
  823. grid on;
  824. xlim([time_Debug_begin time_Debug_end]);
  825. ylim([0.0 10]);
  826. ax = gca;
  827. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  828. xtickformat(xtckfrmt);
  829. %xlabel('Time, s', 'FontSize', FontSize);
  830. ylabel('I_{syn}, \muA/cm^2', 'FontSize', FontSize);
  831. title(['I_{syn}(t) for ', num2str(2), '^{nd} neuron'], 'FontSize', FontSize);
  832. set(gca, 'FontSize', FontSize);
  833.  
  834. subplot(4, 5, 9);
  835. omega_cur = 0;
  836. omega_total = [];
  837. time_total = [];
  838. %yyaxis left;
  839. regular_V_spiking_counter = 0;
  840. %for i = 1:size(V, 2)
  841. i = 2;
  842.     V_p = V(:, i);
  843.     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  844.    
  845.     for pks_counter = 1:size(pks, 1)
  846.         pks(pks_counter) = i;
  847.     end
  848.  
  849.     if isempty([pks, locs]) || size(pks, 1) == 1
  850.         omega_cur = 0;
  851.         omega_total = [omega_total omega_cur'];
  852.         time_locs = locs;
  853.         time_locs = time_locs(2:end);
  854.         %time_locs = time_locs(find(omega_cur'<=60));
  855.         time_total = [time_total time_locs'];
  856.         %plot(omega_cur, i, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  857.         %hold on;
  858.     end
  859.     if ~isempty([pks, locs]) && size(pks, 1) > 1
  860.         regular_V_spiking_counter = regular_V_spiking_counter + 1;
  861.         omega_cur = 1./diff(locs);
  862.         %omega_cur = omega_cur(find(omega_cur'<=60));
  863.         omega_total = [omega_total omega_cur'];
  864.         time_locs = locs;
  865.         time_locs = time_locs(2:end);
  866.         %time_locs = time_locs(find(omega_cur'<=60));
  867.         time_total = [time_total time_locs'];
  868.         %plot(omega_cur, pks(2:end), 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  869.         %hold on;
  870.     end
  871.    
  872.     if ~isempty([pks, locs]) && size(pks, 1) > 1
  873.         plot(time_locs, omega_cur,  '-', 'LineWidth', 1);
  874.         hold on;
  875.     end
  876. %end
  877.  
  878. set(gca, 'FontSize', FontSize);
  879. grid on;
  880. box on;
  881. xlim([time_Debug_begin time_Debug_end]);
  882. ylim([freq_min freq_max]);
  883. ax = gca;
  884. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  885. xtickformat(xtckfrmt);
  886. ax.YTick = [freq_min: d_freq: freq_max];
  887. %legend('<\nu_i>');
  888. %xlabel('Time, sec', 'FontSize', FontSize);
  889. ylabel('\nu, s^{-1}', 'FontSize', FontSize);
  890. title([num2str(2), '^{nd} neuron frequencies'], 'FontSize', FontSize);
  891.  
  892. subplot(4, 5, 10)
  893. plot(time_locs_2(1:min_time_size_RN_SN), mod(phi_RN_SN, 2*pi), '.', 'LineWidth', 1);
  894. set(gca, 'FontSize', FontSize);
  895. grid on;
  896. xlim([time_Debug_begin time_Debug_end]);
  897. ylim([0 2*pi]);
  898. ax = gca;
  899. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  900. yticks([0, pi/2, pi, 3*pi/2, 2*pi])
  901. yticklabels({'0','\pi/2','\pi','3/2 \pi','2 \pi'})
  902. %xlabel('Time, sec', 'FontSize', FontSize);
  903. ylabel('\Delta \phi_{1, 2}, rad', 'FontSize', FontSize);
  904. title('\Delta \phi_{1, 2}', 'FontSize', FontSize);
  905.  
  906. subplot(4, 5, 11);
  907. plot(time_V, V(:, 3), 'LineWidth', 1);
  908. grid on;
  909. xlim([time_Debug_begin time_Debug_end]);
  910. ylim([-80 40]);
  911. ax = gca;
  912. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  913. xtickformat(xtckfrmt);
  914. %xlabel('Time, s', 'FontSize', FontSize);
  915. ylabel('V, mV', 'FontSize', FontSize);
  916. title(['V(t) for ', num2str(3), '^{rd} neuron'], 'FontSize', FontSize);
  917. set(gca, 'FontSize', FontSize);
  918.  
  919. subplot(4, 5, 12);
  920. plot(time_I_stim, I_stim_SF(:, 3), 'LineWidth', 1);
  921. grid on;
  922. xlim([time_Debug_begin time_Debug_end]);
  923. ylim([0.0 I_stim_max]);
  924. ax = gca;
  925. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  926. xtickformat(xtckfrmt);
  927. %xlabel('Time, s', 'FontSize', FontSize);
  928. ylabel('I_{stim}, \muA/cm^2', 'FontSize', FontSize);
  929. title(['I_{stim}(t) for ', num2str(3), '^{rd} neuron'], 'FontSize', FontSize);
  930. set(gca, 'FontSize', FontSize);
  931.  
  932. subplot(4, 5, 13);
  933. plot(time_I_syn, I_syn(:, 3), 'LineWidth', 1);
  934. grid on;
  935. xlim([time_Debug_begin time_Debug_end]);
  936. ylim([0.0 10]);
  937. ax = gca;
  938. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  939. xtickformat(xtckfrmt);
  940. %xlabel('Time, s', 'FontSize', FontSize);
  941. ylabel('I_{syn}, \muA/cm^2', 'FontSize', FontSize);
  942. title(['I_{syn}(t) for ', num2str(3), '^{rd} neuron'], 'FontSize', FontSize);
  943. set(gca, 'FontSize', FontSize);
  944.  
  945. subplot(4, 5, 14);
  946. omega_cur = 0;
  947. omega_total = [];
  948. time_total = [];
  949. %yyaxis left;
  950. regular_V_spiking_counter = 0;
  951. %for i = 1:size(V, 2)
  952. i = 3;
  953.     V_p = V(:, i);
  954.     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  955.    
  956.     for pks_counter = 1:size(pks, 1)
  957.         pks(pks_counter) = i;
  958.     end
  959.  
  960.     if isempty([pks, locs]) || size(pks, 1) == 1
  961.         omega_cur = 0;
  962.         omega_total = [omega_total omega_cur'];
  963.         time_locs = locs;
  964.         time_locs = time_locs(2:end);
  965.         %time_locs = time_locs(find(omega_cur'<=60));
  966.         time_total = [time_total time_locs'];
  967.         %plot(omega_cur, i, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  968.         %hold on;
  969.     end
  970.     if ~isempty([pks, locs]) && size(pks, 1) > 1
  971.         regular_V_spiking_counter = regular_V_spiking_counter + 1;
  972.         omega_cur = 1./diff(locs);
  973.         %omega_cur = omega_cur(find(omega_cur'<=60));
  974.         omega_total = [omega_total omega_cur'];
  975.         time_locs = locs;
  976.         time_locs = time_locs(2:end);
  977.         %time_locs = time_locs(find(omega_cur'<=60));
  978.         time_total = [time_total time_locs'];
  979.         %plot(omega_cur, pks(2:end), 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  980.         %hold on;
  981.     end
  982.    
  983.     if ~isempty([pks, locs]) && size(pks, 1) > 1
  984.         plot(time_locs, omega_cur,  '-', 'LineWidth', 1);
  985.         hold on;
  986.     end
  987. %end
  988.  
  989. set(gca, 'FontSize', FontSize);
  990. grid on;
  991. box on;
  992. xlim([time_Debug_begin time_Debug_end]);
  993. ylim([freq_min freq_max]);
  994. ax = gca;
  995. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  996. xtickformat(xtckfrmt);
  997. ax.YTick = [freq_min: d_freq: freq_max];
  998. %legend('<\nu_i>');
  999. xlabel('Time, sec', 'FontSize', FontSize);
  1000. ylabel('\nu, s^{-1}', 'FontSize', FontSize);
  1001. title([num2str(3), '^{rd} neuron frequencies'], 'FontSize', FontSize);
  1002.  
  1003. subplot(4, 5, 15)
  1004. plot(time_locs_3(1:min_time_size_1_3), mod(phi_1_3, 2*pi), '.', 'LineWidth', 1);
  1005. set(gca, 'FontSize', FontSize);
  1006. grid on;
  1007. xlim([time_Debug_begin time_Debug_end]);
  1008. ylim([0 2*pi]);
  1009. ax = gca;
  1010. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  1011. yticks([0, pi/2, pi, 3*pi/2, 2*pi])
  1012. yticklabels({'0','\pi/2','\pi','3/2 \pi','2 \pi'})
  1013. %xlabel('Time, sec', 'FontSize', FontSize);
  1014. ylabel('\Delta \phi_{1, 3}, rad', 'FontSize', FontSize);
  1015. title('\Delta \phi_{1, 3}', 'FontSize', FontSize);
  1016.  
  1017. subplot(4, 5, 16);
  1018. plot(time_V, V(:, 4), 'LineWidth', 1);
  1019. grid on;
  1020. xlim([time_Debug_begin time_Debug_end]);
  1021. ylim([-80 40]);
  1022. ax = gca;
  1023. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  1024. xtickformat(xtckfrmt);
  1025. xlabel('Time, s', 'FontSize', FontSize);
  1026. ylabel('V, mV', 'FontSize', FontSize);
  1027. title(['V(t) for ', num2str(4), '^{th} neuron'], 'FontSize', FontSize);
  1028. set(gca, 'FontSize', FontSize);
  1029.  
  1030. subplot(4, 5, 17);
  1031. plot(time_I_stim, I_stim_SF(:, 4), 'LineWidth', 1);
  1032. grid on;
  1033. xlim([time_Debug_begin time_Debug_end]);
  1034. ylim([0.0 I_stim_max]);
  1035. ax = gca;
  1036. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  1037. xtickformat(xtckfrmt);
  1038. xlabel('Time, s', 'FontSize', FontSize);
  1039. ylabel('I_{stim}, \muA/cm^2', 'FontSize', FontSize);
  1040. title(['I_{stim}(t) for ', num2str(4), '^{th} neuron'], 'FontSize', FontSize);
  1041. set(gca, 'FontSize', FontSize);
  1042.  
  1043. subplot(4, 5, 18);
  1044. plot(time_I_syn, I_syn(:, 4), 'LineWidth', 1);
  1045. grid on;
  1046. xlim([time_Debug_begin time_Debug_end]);
  1047. ylim([0.0 10]);
  1048. ax = gca;
  1049. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  1050. xtickformat(xtckfrmt);
  1051. xlabel('Time, s', 'FontSize', FontSize);
  1052. ylabel('I_{syn}, \muA/cm^2', 'FontSize', FontSize);
  1053. title(['I_{syn}(t) for ', num2str(4), '^{th} neuron'], 'FontSize', FontSize);
  1054. set(gca, 'FontSize', FontSize);
  1055.  
  1056. subplot(4, 5, 19);
  1057. omega_cur = 0;
  1058. omega_total = [];
  1059. time_total = [];
  1060. %yyaxis left;
  1061. regular_V_spiking_counter = 0;
  1062. %for i = 1:size(V, 2)
  1063. i = 4;
  1064.     V_p = V(:, i);
  1065.     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  1066.    
  1067.     for pks_counter = 1:size(pks, 1)
  1068.         pks(pks_counter) = i;
  1069.     end
  1070.  
  1071.     if isempty([pks, locs]) || size(pks, 1) == 1
  1072.         omega_cur = 0;
  1073.         omega_total = [omega_total omega_cur'];
  1074.         time_locs = locs;
  1075.         time_locs = time_locs(2:end);
  1076.         %time_locs = time_locs(find(omega_cur'<=60));
  1077.         time_total = [time_total time_locs'];
  1078.         %plot(omega_cur, i, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  1079.         %hold on;
  1080.     end
  1081.     if ~isempty([pks, locs]) && size(pks, 1) > 1
  1082.         regular_V_spiking_counter = regular_V_spiking_counter + 1;
  1083.         omega_cur = 1./diff(locs);
  1084.         %omega_cur = omega_cur(find(omega_cur'<=60));
  1085.         omega_total = [omega_total omega_cur'];
  1086.         time_locs = locs;
  1087.         time_locs = time_locs(2:end);
  1088.         %time_locs = time_locs(find(omega_cur'<=60));
  1089.         time_total = [time_total time_locs'];
  1090.         %plot(omega_cur, pks(2:end), 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  1091.         %hold on;
  1092.     end
  1093.    
  1094.     if ~isempty([pks, locs]) && size(pks, 1) > 1
  1095.         plot(time_locs, omega_cur,  '-', 'LineWidth', 1);
  1096.         hold on;
  1097.     end
  1098. %end
  1099.  
  1100. set(gca, 'FontSize', FontSize);
  1101. grid on;
  1102. box on;
  1103. xlim([time_Debug_begin time_Debug_end]);
  1104. ylim([freq_min freq_max]);
  1105. ax = gca;
  1106. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  1107. xtickformat(xtckfrmt);
  1108. ax.YTick = [freq_min: d_freq: freq_max];
  1109. %legend('<\nu_i>');
  1110. xlabel('Time, sec', 'FontSize', FontSize);
  1111. ylabel('\nu, s^{-1}', 'FontSize', FontSize);
  1112. title([num2str(4), '^{th} neuron frequencies'], 'FontSize', FontSize);
  1113.  
  1114. subplot(4, 5, 20)
  1115. plot(time_locs_4(1:min_time_size_1_4), mod(phi_1_4, 2*pi), '.', 'LineWidth', 1);
  1116. set(gca, 'FontSize', FontSize);
  1117. grid on;
  1118. xlim([time_Debug_begin time_Debug_end]);
  1119. ylim([0 2*pi]);
  1120. ax = gca;
  1121. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  1122. yticks([0, pi/2, pi, 3*pi/2, 2*pi])
  1123. yticklabels({'0','\pi/2','\pi','3/2 \pi','2 \pi'})
  1124. xlabel('Time, sec', 'FontSize', FontSize);
  1125. ylabel('\Delta \phi_{1, 4}, rad', 'FontSize', FontSize);
  1126. title('\Delta \phi_{1, 4}', 'FontSize', FontSize);
  1127.  
  1128. saveas(gcf, 'results_V_I_stim_I_syn_nu_phase_Recogn_4.png');
  1129. %saveas(gcf, 'results_V_I_stim_I_syn_nu_phase_Recogn_4', 'epsc');
  1130. close(results_V_I_stim_I_syn_nu_phase_Recogn_4);
  1131. disp('Picture results_V_I_stim_I_syn_nu_phase_Recogn_4 save');
  1132.  
  1133. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1134.  
  1135. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1136.  
  1137.  
  1138. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1139.  
  1140. return
  1141.  
  1142. results_I_stim_Recogn_3rd = figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  1143.  
  1144. plot(time_I_syn, I_syn(:, 3), 'LineWidth', 1);
  1145. grid on;
  1146. xlim([time_Debug_begin time_Debug_end]);
  1147. ylim([0.0 10]);
  1148. ax = gca;
  1149. ax.XTick = [time_Debug_begin: d_time_Debug: time_Debug_end];
  1150. xtickformat(xtckfrmt);
  1151. %xlabel('Time, s', 'FontSize', FontSize);
  1152. ylabel('I_{syn}, \muA/cm^2', 'FontSize', FontSize);
  1153. title(['I_{syn}(t) for ', num2str(3), '^{rd} neuron'], 'FontSize', FontSize);
  1154. set(gca, 'FontSize', FontSize);
  1155.  
  1156. saveas(gcf, 'results_I_stim_Recogn_3rd.png');
  1157. %saveas(gcf, 'results_I_stim_Recogn_3rd', 'epsc');
  1158. close(results_I_stim_Recogn_3rd);
  1159. disp('Picture results_I_stim_Recogn_3rd save');
  1160.  
  1161. return
  1162.  
  1163. % subplot(4, 1, 3);
  1164. % plot(time_I_syn, I_syn(:, ii), 'LineWidth', 1);
  1165. % grid on;
  1166. % xlim([0 15.0]);
  1167. % %ylim([0.0 20]);
  1168. % ax = gca;
  1169. % ax.XTick = [0:1:15.0];
  1170. % xtickformat('%.1f');
  1171. % %xlabel('Time, s', 'FontSize', 18);
  1172. % ylabel('I_{syn}, \muA/cm^2', 'FontSize', 16);
  1173. % %title(['I_{stim}(t) for ', num2str(ii), '^{th} pyramydal neuron. <Freq_{Poisson}> = ', num2str(meanPoissonFreq), ' Hz'], 'FontSize', 24);
  1174. % title(['I_{syn}(t) for ', num2str(ii), '^{th} neuron'], 'FontSize', 16);
  1175. % set(gca, 'FontSize', 16);
  1176. %
  1177. % subplot(4, 1, 4);
  1178. % plot(time_Ca, Ca(:, ii), 'LineWidth', 1);
  1179. % hold on;
  1180. % line([0, 15.0], [0.3, 0.3], 'Color', 'red', 'LineStyle', '--', 'LineWidth', 1);
  1181. % grid on;
  1182. % xlim([0 15.0]);
  1183. % ylim([0.0 0.6]);
  1184. % ax = gca;
  1185. % ax.XTick = [0:1:15.0];
  1186. % xtickformat('%.1f');
  1187. % xlabel('Time, s', 'FontSize', 16);
  1188. % ylabel('[Ca^{2+}], \muM', 'FontSize', 16);
  1189. % %title(['I_{stim}(t) for ', num2str(ii), '^{th} pyramydal neuron. <Freq_{Poisson}> = ', num2str(meanPoissonFreq), ' Hz'], 'FontSize', 24);
  1190. % title(['[Ca^{2+}](t) for ', num2str(ii), '^{th} neuron'], 'FontSize', 16);
  1191. % set(gca, 'FontSize', 16);
  1192. %
  1193. % saveas(gcf, 'results_I_stim_V_I_syn_10x15_time_15_s.png');
  1194. % %saveas(gcf, 'results_I_stim_V_I_syn', 'epsc');
  1195. % close(results_I_stim_V_I_syn_10x15_time_15_s);
  1196. % disp('results_I_stim_V_I_syn_10x15_time_15_s save');
  1197.  
  1198. return
  1199.  
  1200. filename1 = 'results_Ca.txt';
  1201. Data = importdata( [ path1 '/' filename1 ] );
  1202. time_Ca = Data(:, 1);
  1203. Ca = Data(:, 2:end);
  1204. disp('results_Ca load complete');
  1205.  
  1206. %%%%% Video %%%%
  1207. filename1 = 'Matrix_sizes.txt';
  1208. Data = importdata( [ path1 '/' filename1 ] );
  1209. Neuron_width = Data(1);
  1210. Neuron_height = Data(2);
  1211. Astro_width = Data(3);
  1212. Astro_height = Data(4);
  1213.  
  1214. figure('units', 'normalized', 'outerposition', [0 0 1.0 1.0], 'visible', 'on');
  1215. writerObj = VideoWriter('neuron_astro_5x7_time_30_s.avi'); % Name movie.
  1216. writerObj.FrameRate = 60; % How many frames per second.
  1217. open(writerObj);
  1218.  
  1219. %const double dt = 0.00005
  1220.  
  1221. for n = 200000: 5: 360000
  1222.     subplot(1, 2, 1);
  1223.     image_V = reshape(V(n, :), [Neuron_width, Neuron_height]);
  1224.     imagesc(image_V');
  1225.     %hold on;
  1226.     axis equal;
  1227.     axis off;
  1228.     colormap(hot);
  1229.     caxis([-80 40]);
  1230.     colorbar;
  1231.     title(['Neurons. V, mV. Layer size = ' num2str(Neuron_width) 'x' num2str(Neuron_height) '. Time = ' num2str(time_V(n), '%.5f') ' s']);
  1232.     set(gca, 'FontSize', FontSize);
  1233.    
  1234.     subplot(1, 2, 2);
  1235.     image_Ca = reshape(Ca(n, :), [Astro_width, Astro_height]);
  1236.     imagesc(image_Ca');
  1237.     %hold on;
  1238.     axis equal;
  1239.     axis off;
  1240.     colormap(hot);
  1241.     caxis([0 0.6]);
  1242.     colorbar;
  1243.     title(['Astrosytes. [Ca^{2+}], \muM. Layer size = ' num2str(Astro_width) 'x' num2str(Astro_height) '. Time = ' num2str(time_Ca(n), '%.5f') ' s']);
  1244.     set(gca, 'FontSize', FontSize);
  1245.    
  1246.     %pause(1/100000000);
  1247.     frame = getframe(gcf); % 'gcf' can handle if you zoom in to take a movie.
  1248.     writeVideo(writerObj, frame);
  1249. end
  1250.  
  1251. hold off
  1252. close(writerObj); % Save the movie.
  1253. disp('Video has saved');
  1254.  
  1255. return
  1256.  
  1257. %%% Spikes Debug Rnd %%%
  1258.  
  1259. % ii = 1;
  1260. %
  1261. % results_I_stim_V_I_syn_10x15_time_15_s = figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  1262. %
  1263. % subplot(4, 1, 1);
  1264. % plot(time_I_stim, I_stim(:, ii), 'LineWidth', 1);
  1265. % grid on;
  1266. % xlim([0 15.0]);
  1267. % %ylim([0.0 10]);
  1268. % ax = gca;
  1269. % ax.XTick = [0:1:15.0];
  1270. % xtickformat('%.1f');
  1271. % %xlabel('Time, s', 'FontSize', 18);
  1272. % ylabel('I_{stim}, \muA/cm^2', 'FontSize', 16);
  1273. % %title(['I_{stim}(t) for ', num2str(ii), '^{th} pyramydal neuron. <F_{in}> = ', num2str(F_in), ' Hz', 'g_{syn P} = ', num2str(g_syn_P)], 'FontSize', 24);
  1274. % title(['I_{stim}(t) for ', num2str(ii), '^{th} neuron'], 'FontSize', 16);
  1275. % set(gca, 'FontSize', 16);
  1276. %
  1277. % subplot(4, 1, 2);
  1278. % plot(time_V, V(:, ii), 'LineWidth', 1);
  1279. % grid on;
  1280. % xlim([0 15.0]);
  1281. % ylim([-80 40]);
  1282. % ax = gca;
  1283. % ax.XTick = [0:1:15.0];
  1284. % xtickformat('%.1f');
  1285. % %xlabel('Time, s', 'FontSize', 18);
  1286. % ylabel('V, mV', 'FontSize', 16);
  1287. % title(['V(t) for ', num2str(ii), '^{th} neuron'], 'FontSize', 16);
  1288. % set(gca, 'FontSize', 16);
  1289. %
  1290. % subplot(4, 1, 3);
  1291. % plot(time_I_syn, I_syn(:, ii), 'LineWidth', 1);
  1292. % grid on;
  1293. % xlim([0 15.0]);
  1294. % %ylim([0.0 20]);
  1295. % ax = gca;
  1296. % ax.XTick = [0:1:15.0];
  1297. % xtickformat('%.1f');
  1298. % %xlabel('Time, s', 'FontSize', 18);
  1299. % ylabel('I_{syn}, \muA/cm^2', 'FontSize', 16);
  1300. % %title(['I_{stim}(t) for ', num2str(ii), '^{th} pyramydal neuron. <Freq_{Poisson}> = ', num2str(meanPoissonFreq), ' Hz'], 'FontSize', 24);
  1301. % title(['I_{syn}(t) for ', num2str(ii), '^{th} neuron'], 'FontSize', 16);
  1302. % set(gca, 'FontSize', 16);
  1303. %
  1304. % subplot(4, 1, 4);
  1305. % plot(time_Ca, Ca(:, ii), 'LineWidth', 1);
  1306. % hold on;
  1307. % line([0, 15.0], [0.3, 0.3], 'Color', 'red', 'LineStyle', '--', 'LineWidth', 1);
  1308. % grid on;
  1309. % xlim([0 15.0]);
  1310. % ylim([0.0 0.6]);
  1311. % ax = gca;
  1312. % ax.XTick = [0:1:15.0];
  1313. % xtickformat('%.1f');
  1314. % xlabel('Time, s', 'FontSize', 16);
  1315. % ylabel('[Ca^{2+}], \muM', 'FontSize', 16);
  1316. % %title(['I_{stim}(t) for ', num2str(ii), '^{th} pyramydal neuron. <Freq_{Poisson}> = ', num2str(meanPoissonFreq), ' Hz'], 'FontSize', 24);
  1317. % title(['[Ca^{2+}](t) for ', num2str(ii), '^{th} neuron'], 'FontSize', 16);
  1318. % set(gca, 'FontSize', 16);
  1319. %
  1320. % saveas(gcf, 'results_I_stim_V_I_syn_10x15_time_15_s.png');
  1321. % %saveas(gcf, 'results_I_stim_V_I_syn', 'epsc');
  1322. % close(results_I_stim_V_I_syn_10x15_time_15_s);
  1323. % disp('results_I_stim_V_I_syn_10x15_time_15_s save');
  1324.  
  1325. results_neuron_raster_3x4_time_5_s = figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  1326.  
  1327. if (size(time_V, 2) > size(time_V, 1))
  1328.     time_V = time_V';
  1329. end
  1330. regular_V_spiking_counter = 0;
  1331. for i = 1:size(V, 2)
  1332.     %V_p = V(:, 1);
  1333.     V_p = V(:, i);
  1334.     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  1335.     if ~isempty([pks, locs])
  1336.         regular_V_spiking_counter = regular_V_spiking_counter + 1;
  1337.     end
  1338.     for pks_counter = 1:size(pks, 1)
  1339.         pks(pks_counter) = i;
  1340.     end
  1341.     plot(locs, pks, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  1342.     hold on;
  1343.      
  1344.     %N_time_V_array(i, ismember(round(time_V*1e5), round(locs*1e5))) = 1;
  1345. end
  1346.  
  1347. xlim([0.0 5.0]);
  1348. ylim([0 size(V, 2)+1]);
  1349. %rectangle('Position',[33, 0, 1, 201], 'EdgeColor', '[0.0 1.0 0.0 0.5]', 'LineWidth', 3);
  1350. hold on;
  1351. box on;
  1352. grid on;
  1353. ax = gca;
  1354. ax = gca;
  1355. xtickformat('%.1f');
  1356. set(gca, 'XTick', [0.0:0.2:5.0]);
  1357. %ax.YTick = [0:sqrt(size(V, 2)):size(V, 2)];
  1358. ax.YTick = [1, [10 :10 :size(V, 2)]];
  1359. xlabel('Time, s', 'FontSize', 20);
  1360. ylabel('Neuron #', 'FontSize', 20);
  1361. title(['Neurons raster'], 'FontSize', 20);
  1362. set(gca, 'FontSize', 20);
  1363.  
  1364. saveas(gcf, 'results_neuron_spiking_10x15_time_5_s.png');
  1365. %saveas(gcf, 'results_neuron_spiking', 'epsc');
  1366. close(results_neuron_raster_3x4_time_5_s);
  1367. disp('Picture results_neuron_spiking_10x15_time_5_s save');
  1368.  
  1369. results_neuron_spiking_10x15_time_05_s = figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  1370.  
  1371. if (size(time_V, 2) > size(time_V, 1))
  1372.     time_V = time_V';
  1373. end
  1374. regular_V_spiking_counter = 0;
  1375. for i = 1:size(V, 2)
  1376.     %V_p = V(:, 1);
  1377.     V_p = V(:, i);
  1378.     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  1379.     if ~isempty([pks, locs])
  1380.         regular_V_spiking_counter = regular_V_spiking_counter + 1;
  1381.     end
  1382.     for pks_counter = 1:size(pks, 1)
  1383.         pks(pks_counter) = i;
  1384.     end
  1385.     plot(locs, pks, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  1386.     hold on;
  1387.      
  1388.     %N_time_V_array(i, ismember(round(time_V*1e5), round(locs*1e5))) = 1;
  1389. end
  1390.  
  1391. xlim([0.0 0.5]);
  1392. ylim([0 size(V, 2)+1]);
  1393. %rectangle('Position',[33, 0, 1, 201], 'EdgeColor', '[0.0 1.0 0.0 0.5]', 'LineWidth', 3);
  1394. hold on;
  1395. box on;
  1396. grid on;
  1397. ax = gca;
  1398. ax = gca;
  1399. xtickformat('%.2f');
  1400. set(gca, 'XTick', [0.0:0.02:0.5]);
  1401. %ax.YTick = [0:sqrt(size(V, 2)):size(V, 2)];
  1402. ax.YTick = [1, [5 :5 :size(V, 2)]];
  1403. xlabel('Time, s', 'FontSize', 20);
  1404. ylabel('Neuron #', 'FontSize', 20);
  1405. title(['Neurons raster'], 'FontSize', 20);
  1406. set(gca, 'FontSize', 20);
  1407.  
  1408. saveas(gcf, 'results_neuron_spiking_10x15_time_05_s.png');
  1409. %saveas(gcf, 'results_neuron_spiking', 'epsc');
  1410. close(results_neuron_spiking_10x15_time_05_s);
  1411. disp('results_neuron_spiking_10x15_time_05_s save');
  1412.  
  1413. % results_neuron_spiking_10x15_time_15_s = figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  1414. %
  1415. % if (size(time_V, 2) > size(time_V, 1))
  1416. %     time_V = time_V';
  1417. % end
  1418. % regular_V_spiking_counter = 0;
  1419. % for i = 1:size(V, 2)
  1420. %     %V_p = V(:, 1);
  1421. %     V_p = V(:, i);
  1422. %     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  1423. %     if ~isempty([pks, locs])
  1424. %         regular_V_spiking_counter = regular_V_spiking_counter + 1;
  1425. %     end
  1426. %     for pks_counter = 1:size(pks, 1)
  1427. %         pks(pks_counter) = i;
  1428. %     end
  1429. %     plot(locs, pks, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  1430. %     hold on;
  1431. %      
  1432. %     %N_time_V_array(i, ismember(round(time_V*1e5), round(locs*1e5))) = 1;
  1433. % end
  1434. %
  1435. % xlim([0 15.0]);
  1436. % ylim([0 size(V, 2)+1]);
  1437. % %rectangle('Position',[33, 0, 1, 201], 'EdgeColor', '[0.0 1.0 0.0 0.5]', 'LineWidth', 3);
  1438. % hold on;
  1439. % box on;
  1440. % grid on;
  1441. % ax = gca;
  1442. % ax = gca;
  1443. % xtickformat('%.1f');
  1444. % set(gca, 'XTick', [0:1:15.0]);
  1445. % %ax.YTick = [0:sqrt(size(V, 2)):size(V, 2)];
  1446. % ax.YTick = [1, [10 :10 :size(V, 2)]];
  1447. % xlabel('Time, s', 'FontSize', 20);
  1448. % ylabel('Neuron #', 'FontSize', 20);
  1449. % title(['Neurons raster'], 'FontSize', 20);
  1450. % set(gca, 'FontSize', 20);
  1451. %
  1452. % saveas(gcf, 'results_neuron_spiking_10x15_time_15_s.png');
  1453. % %saveas(gcf, 'results_neuron_spiking', 'epsc');
  1454. % close(results_neuron_spiking_10x15_time_15_s);
  1455. % disp('results_neuron_spiking_10x15_time_15_s save');
  1456.  
  1457. % results_neuron_spiking_30x40_detailed = figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  1458. %
  1459. % if (size(time_V, 2) > size(time_V, 1))
  1460. %     time_V = time_V';
  1461. % end
  1462. % regular_V_spiking_counter = 0;
  1463. % for i = 1:size(V, 2)
  1464. %     %V_p = V(:, 1);
  1465. %     V_p = V(:, i);
  1466. %     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  1467. %     if ~isempty([pks, locs])
  1468. %         regular_V_spiking_counter = regular_V_spiking_counter + 1;
  1469. %     end
  1470. %     for pks_counter = 1:size(pks, 1)
  1471. %         pks(pks_counter) = i;
  1472. %     end
  1473. %     plot(locs, pks, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  1474. %     hold on;
  1475. %      
  1476. %     %N_time_V_array(i, ismember(round(time_V*1e5), round(locs*1e5))) = 1;
  1477. % end
  1478. %
  1479. % xlim([0.20 0.35]);
  1480. % ylim([0 size(V, 2)+1]);
  1481. % %rectangle('Position',[33, 0, 1, 201], 'EdgeColor', '[0.0 1.0 0.0 0.5]', 'LineWidth', 3);
  1482. % hold on;
  1483. % box on;
  1484. % grid on;
  1485. % ax = gca;
  1486. % ax = gca;
  1487. % xtickformat('%.2f');
  1488. % set(gca, 'XTick', [0.20:0.01:0.35]);
  1489. % %ax.YTick = [0:sqrt(size(V, 2)):size(V, 2)];
  1490. % ax.YTick = [1, [30 :30 :size(V, 2)]];
  1491. % xlabel('Time, s', 'FontSize', 20);
  1492. % ylabel('Neuron #', 'FontSize', 20);
  1493. % title(['Neurons raster'], 'FontSize', 20);
  1494. % set(gca, 'FontSize', 20);
  1495. %
  1496. % saveas(gcf, 'results_neuron_spiking_30x40_detailed.png');
  1497. % %saveas(gcf, 'results_neuron_spiking', 'epsc');
  1498. % close(results_neuron_spiking_30x40_detailed);
  1499. % disp('results_neuron_spiking_30x40_detailed save');
  1500.  
  1501. % results_image_E_syn = figure('units', 'normalized', 'outerposition', [0 0 1 1]);
  1502. % image_E_syn = reshape(E_syn, [40, 50]);
  1503. % imagesc(image_E_syn');
  1504. % %hold on;
  1505. % axis equal;
  1506. % axis off;
  1507. % %MyColorMap = [1 0 0] [0 1 0];
  1508. % %MyColorMap = {'#FF0000', '#00FF00'};
  1509. % %colormap(MyColorMap);
  1510. % colormap(gray(2));
  1511. % caxis([-90 0]);
  1512. % cbh = colorbar('v');
  1513. % set(cbh, 'YTick', [-90 0]);
  1514. % %caxis([-80 40]);
  1515. % colorbar;
  1516. % title(['Neurons. E_{syn}, mV. Layer size = ' num2str(40) 'x' num2str(50) '.']);
  1517. % set(gca, 'FontSize', 20);
  1518. % saveas(gcf, 'results_image_E_syn.png');
  1519. % %saveas(gcf, 'results_image_E_syn', 'epsc');
  1520. % close(results_image_E_syn);
  1521. % disp('results_image_E_syn save');
  1522.  
  1523. return
  1524.  
  1525. %%%%% Correlation Begin %%%%%%
  1526.  
  1527. theta = time_V;
  1528. x1 = V(:, 1);
  1529. x2 = V(:, 12);
  1530.  
  1531. % theta = linspace(0,2*pi,100);
  1532. % x1 = sin(theta);
  1533. % x2 = sin(1.2*theta);
  1534.  
  1535. [r, lags] = xcorr(x1,x2);
  1536. clf()
  1537.  
  1538. figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  1539. tiledlayout(2,1)
  1540. nexttile
  1541. hold on
  1542. plot(theta, x1, 'DisplayName', 'x1')
  1543. plot(theta, x2, 'DisplayName', 'x2')
  1544. legend()
  1545. nexttile
  1546. plot(lags,r, '-');
  1547. xlim([-0.05 0.05]);
  1548. grid on
  1549. xlabel('lag')
  1550. ylabel('cross-corr');
  1551.  
  1552. %%%%% Correlation End %%%%%%%%
  1553.  
  1554. return
  1555.  
  1556. figure('units', 'normalized', 'outerposition', [0 0 1 1]);
  1557.  
  1558. writerObj = VideoWriter('neuron_10x15_time_5_s.avi'); % Name movie.
  1559. writerObj.FrameRate = 45; % How many frames per second.
  1560. open(writerObj);
  1561.  
  1562. for n = 1:20:size(V, 1)
  1563.     image_V = reshape(V(n, :), [10, 15]);
  1564.     imagesc(image_V');
  1565.     %hold on;
  1566.     axis equal;
  1567.     axis off;
  1568.     colormap(hot);
  1569.     caxis([-80 40]);
  1570.     colorbar;
  1571.     title(['Neurons. V, mV. Layer size = ' num2str(10) 'x' num2str(15) '. Time = ' num2str(time_V(n), '%.5f') ' s']);
  1572.     set(gca, 'FontSize', 20);
  1573.     %pause(1/100000000);
  1574.     frame = getframe(gcf); % 'gcf' can handle if you zoom in to take a movie.
  1575.     writeVideo(writerObj, frame);
  1576. end
  1577.  
  1578. hold off
  1579. close(writerObj); % Save the movie.
  1580.  
  1581. return
  1582.  
  1583. figure('units', 'normalized', 'outerposition', [0 0 1 1]);
  1584.  
  1585. writerObj = VideoWriter('astro_90x100_time_3_s.avi'); % Name movie.
  1586. writerObj.FrameRate = 30; % How many frames per second.
  1587. open(writerObj);
  1588.  
  1589. for n = 1:5000:size(Ca, 1)
  1590.     image_Ca = reshape(Ca(n, :), [90, 100]);
  1591.     imagesc(image_Ca');
  1592.     %hold on;
  1593.     axis equal;
  1594.     axis off;
  1595.     colormap(hot);
  1596.     caxis([0 0.6]);
  1597.     colorbar;
  1598.     title(['Astrocytes. [Ca^{2+}], \muM. Layer size = ' num2str(90) 'x' num2str(100) '. Time = ' num2str(time_Ca(n), '%.5f') ' s']);
  1599.     set(gca, 'FontSize', 20);
  1600.     %pause(1/100000000);
  1601.     frame = getframe(gcf); % 'gcf' can handle if you zoom in to take a movie.
  1602.     writeVideo(writerObj, frame);
  1603. end
  1604.  
  1605. hold off
  1606. close(writerObj); % Save the movie.
  1607.  
  1608. return
  1609.  
  1610. clear all;
  1611.  
  1612. return
  1613.  
  1614. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1615.  
  1616. % filename0 = 'A_A.txt';
  1617. % path0 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  1618. % Data_A_A = importdata( [ path0 '/' filename0 ] );
  1619. %
  1620. % filename1 = 'A_N.txt';
  1621. % path1 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  1622. % Data_A_N = importdata( [ path1 '/' filename1 ] );
  1623. %
  1624. % filename2 = 'results_E_syn.txt';
  1625. % path1 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  1626. % E_syn = importdata( [ path1 '/' filename2 ] );
  1627. %
  1628. % Data_A_N = Data_A_N.*(2*sign(repmat(E_syn,1,size(Data_A_N,2)))+1);
  1629. %
  1630. % filename3 = 'p_rewir.txt';
  1631. % path3 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  1632. % Data = importdata( [ path3 '/' filename3 ] );
  1633. % p_rewir = Data(1, 1);
  1634.  
  1635. %filename3 = 'p_inhib.txt';
  1636. %path3 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  1637. %Data = importdata( [ path3 '/' filename3 ] );
  1638. %p_inhib = Data(1, 1);
  1639.  
  1640. % fig_A_A_A_N = figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  1641. % ax221 = subplot(1, 2, 1);
  1642. % imshow(Data_A_A);
  1643. % %axis ij;
  1644. % axis('on', 'image');
  1645. % %axis equal;
  1646. % daspect([1 1 1])
  1647. % %%axis off;
  1648. % colormap(ax221, gray(2));
  1649. % caxis([0 1]);
  1650. % cbh = colorbar('v');
  1651. % set(cbh, 'YTick', [0:1:1]);
  1652. % %set(gca, 'XTick', [1 size(Data_A_A, 1)/2 size(Data_A_A, 1)]);
  1653. % %set(gca, 'YTick', [1 size(Data_A_A, 2)/2 size(Data_A_A, 2)]);
  1654. % set(gca, 'XTick', [1, 25 :25 :size(Data_A_A, 1)]);
  1655. % set(gca, 'YTick', [1, 25 :25 :size(Data_A_A, 2)]);
  1656. % ax = gca;
  1657. % ax.XAxisLocation = 'top';
  1658. % title('Astrocytes adjacency matrix');
  1659. % set(gca, 'FontSize', 25);
  1660. %
  1661. % ax222 = subplot(1, 2, 2);
  1662. % imshow(Data_A_N);
  1663. % %axis ij;
  1664. % axis('on', 'image');
  1665. % %axis equal;
  1666. % daspect([1 1 1])
  1667. % %%axis off;
  1668. % colormap(ax222, [1 0 0; 0 0 0; 1 1 1]);
  1669. % %colormap(ax222, gray(3));
  1670. % caxis([-1 1]);
  1671. % cbh = colorbar('v');
  1672. % set(cbh, 'YTick', [-1:1:1], 'YTickLabel', {'Inhib conn', 'No conn', 'Excit conn'});
  1673. % %set(gca, 'XTick', [1 size(Data_A_N, 1)/2 size(Data_A_N, 1)]);
  1674. % %set(gca, 'YTick', [1 size(Data_A_N, 2)/2 size(Data_A_N, 2)]);
  1675. % set(gca, 'XTick', [1, 25 :25 :size(Data_A_N, 1)]);
  1676. % set(gca, 'YTick', [1, 25 :25 :size(Data_A_N, 2)]);
  1677. % ax = gca;
  1678. % ax.XAxisLocation = 'top';
  1679. % title(['Neurons adjacency matrix. p_{rewir} = ', num2str(p_rewir), '; p_{inhib} = ', num2str(p_inhib)]);
  1680. % set(gca, 'FontSize', 25);
  1681. %
  1682. % saveas(gcf, 'A_A_A_N.png');
  1683. % saveas(gcf, 'A_A_A_N', 'epsc');
  1684. % close(fig_A_A_A_N);
  1685. % disp('A_A & A_N save');
  1686.  
  1687. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1688. % filename3 = 'results_V_P_g_syn_0010_g_syn_P_07_PoisFr_260_g_astro_m08.txt';
  1689. % path3 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  1690. % Data = importdata( [ path3 '/' filename3 ] );
  1691. % %time_V = Data(round(0.25*end):end, 1);
  1692. % time_V_P = Data(:, 1);
  1693. % %V = Data(round(0.25*end):end, 2:end);
  1694. % V_P = Data(:, 2:end);
  1695. % %time = Data(4800000:end, 1);
  1696. % %V = Data(4800000:end, 2:end);
  1697. % %time = Data(100000:end, 1);
  1698. % %V = Data(100000:end, 2:end);
  1699. % %clear Data;
  1700. % disp('results_V_P load complete');
  1701.  
  1702. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1703. filename3 = 'results_V_g_syn_0010_g_syn_P_07_PoisFr_260_g_astro_m08.txt';
  1704. path3 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  1705. Data = importdata( [ path3 '/' filename3 ] );
  1706. %time_V = Data(round(0.25*end):end, 1);
  1707. time_V = Data(:, 1);
  1708. %V = Data(round(0.25*end):end, 2:end);
  1709. V_m08 = Data(:, 2:end);
  1710. %time = Data(4800000:end, 1);
  1711. %V = Data(4800000:end, 2:end);
  1712. %time = Data(100000:end, 1);
  1713. %V = Data(100000:end, 2:end);
  1714. %clear Data;
  1715. disp('results_V_m08 load complete');
  1716.  
  1717. filename3 = 'results_V_g_syn_0010_g_syn_P_07_PoisFr_260_g_astro_10.txt';
  1718. path3 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  1719. Data = importdata( [ path3 '/' filename3 ] );
  1720. %time_V = Data(round(0.25*end):end, 1);
  1721. time_V = Data(:, 1);
  1722. %V = Data(round(0.25*end):end, 2:end);
  1723. V_10 = Data(:, 2:end);
  1724. %time = Data(4800000:end, 1);
  1725. %V = Data(4800000:end, 2:end);
  1726. %time = Data(100000:end, 1);
  1727. %V = Data(100000:end, 2:end);
  1728. %clear Data;
  1729. disp('results_V_10 load complete');
  1730.  
  1731. filename2 = 'results_Ca_g_syn_0010_g_syn_P_07_PoisFr_260_g_astro_m08.txt';
  1732. path2 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  1733. Data = importdata( [ path2 '/' filename2 ] );
  1734. %time_Ca = Data(round(0.25*end):end, 1);
  1735. time_Ca = Data(:, 1);
  1736. %Ca = Data(round(0.25*end):end, 2:end);
  1737. Ca_m08 = Data(:, 2:end);
  1738. %time = Data(4800000:end, 1);
  1739. %Ca = Data(4800000:end, 2:end);
  1740. clear Data;
  1741. disp('results_Ca_m08 load complete');
  1742.  
  1743. filename2 = 'results_Ca_g_syn_0010_g_syn_P_07_PoisFr_260_g_astro_10.txt';
  1744. path2 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  1745. Data = importdata( [ path2 '/' filename2 ] );
  1746. %time_Ca = Data(round(0.25*end):end, 1);
  1747. time_Ca = Data(:, 1);
  1748. %Ca = Data(round(0.25*end):end, 2:end);
  1749. Ca_10 = Data(:, 2:end);
  1750. %time = Data(4800000:end, 1);
  1751. %Ca = Data(4800000:end, 2:end);
  1752. clear Data;
  1753. disp('results_Ca_10 load complete');
  1754. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1755.  
  1756. % filename6 = 'test_Poisson_g_syn_0010_g_syn_P_07_PoisFr_260_g_astro_m08.txt';
  1757. % path6 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  1758. % Data = importdata( [ path6 '/' filename6 ] );
  1759. % time = Data(:, 1);
  1760. %
  1761. % meanPoissonTimeData = mean(Data);
  1762. % meanPoissonFreq = 1 / meanPoissonTimeData
  1763. %
  1764. % % results_test_Poisson = figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  1765. % % plot(time, 'LineWidth', 1);
  1766. % % hold on;
  1767. % % plot([0, size(Data, 1)], [meanPoissonTimeData, meanPoissonTimeData], 'r', 'LineWidth', 2);
  1768. % % grid on;
  1769. % % set(gca, 'FontSize', 24);
  1770. % % xlabel('Intervals (custom value)', 'FontSize', 50);
  1771. % % ylabel('Time, msec', 'FontSize', 50);
  1772. % % title('Time Poisson interval', 'FontSize', 50);
  1773. % % saveas(gcf, 'test_Poisson.png');
  1774. % % close(results_test_Poisson);
  1775. % % disp('test_Poisson save');
  1776. %
  1777. % filename4 = 'results_I_stim_g_syn_0010_g_syn_P_07_PoisFr_260_g_astro_m08.txt';
  1778. % path4 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  1779. % Data = importdata( [ path4 '/' filename4 ] );
  1780. % time = Data(:, 1);
  1781. % I_stim = Data(:, 2:end);
  1782. % disp('results_I_stim load complete');
  1783. %
  1784. % ii = 5;
  1785.  
  1786. % results_I_stim = figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  1787. % subplot(3, 1, 1);
  1788. % plot(time, I_stim(:, ii), 'LineWidth', 1);
  1789. % grid on;
  1790. % xlim([0 3]);
  1791. % %ylim([-0.2 0.2]);
  1792. % ax = gca;
  1793. % ax.XTick = [0:0.1:3];
  1794. % %xlabel('Time, s', 'FontSize', 24);
  1795. % ylabel('I_{stim}, \muA/cm^2', 'FontSize', 24);
  1796. % title(['I_{stim}(t) for ', num2str(ii), '^{th} neuron. <Freq_{Poisson}> = ', num2str(meanPoissonFreq), ' Hz'], 'FontSize', 24);
  1797. % set(gca, 'FontSize', 24);
  1798. %
  1799. % subplot(3, 1, 2);
  1800. % plot(time_V_P, V_P(:, ii), 'LineWidth', 1);
  1801. % grid on;
  1802. % xlim([0 3]);
  1803. % ylim([-80 40]);
  1804. % ax = gca;
  1805. % ax.XTick = [0:0.1:3];
  1806. % %xlabel('Time, s', 'FontSize', 24);
  1807. % ylabel('V, mV', 'FontSize', 24);
  1808. % title(['V_{P}(t) for ', num2str(ii), '^{th} neuron'], 'FontSize', 24);
  1809. % set(gca, 'FontSize', 24);
  1810. %
  1811. % subplot(3, 1, 3);
  1812. % plot(time_V, V(:, ii), 'LineWidth', 1);
  1813. % grid on;
  1814. % xlim([0 3]);
  1815. % ylim([-80 40]);
  1816. % ax = gca;
  1817. % ax.XTick = [0:0.1:3];
  1818. % xlabel('Time, s', 'FontSize', 24);
  1819. % ylabel('V, mV', 'FontSize', 24);
  1820. % title(['V(t) for ', num2str(ii), '^{th} neuron'], 'FontSize', 24);
  1821. % set(gca, 'FontSize', 24);
  1822. %
  1823. % saveas(gcf, 'results_I_stim.png');
  1824. % %saveas(gcf, 'results_I_stim', 'epsc');
  1825. % close(results_I_stim);
  1826. % disp('results_I_stim save');
  1827.  
  1828. %%%%%%%%%%%%% V_P Freq %%%%%%%%%%%%%%
  1829. % results_V_P_Freq = figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  1830. % subplot(3, 1, 1);
  1831. % plot(time_V_P, V_P(:, :), 'LineWidth', 1);
  1832. % set(gca, 'FontSize', 14);
  1833. % grid on;
  1834. % xlim([0 5]);
  1835. % ylim([-80 40]);
  1836. % ax = gca;
  1837. % ax.XTick = [0:0.1:5];
  1838. % %xlabel('Time, s', 'FontSize', 14);
  1839. % ylabel('V, mV', 'FontSize', 14);
  1840. % title('V_P_i(t)', 'FontSize', 15);
  1841. %
  1842. % subplot(3, 1, 2);
  1843. % %time_V_P = time_V_P';
  1844. % regular_V_P_spiking_counter = 0;
  1845. % for i = 1:size(V_P, 2)
  1846. %     %V_p = V(:, 1);
  1847. %     V_P_p = V_P(:, i);
  1848. %     [pks, locs] = findpeaks(V_P_p, time_V_P, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  1849. %     if ~isempty([pks, locs])
  1850. %         regular_V_P_spiking_counter = regular_V_P_spiking_counter + 1;
  1851. %     end
  1852. %     for pks_counter = 1:size(pks, 1)
  1853. %         pks(pks_counter) = i;
  1854. %     end
  1855. %     plot(locs, pks, 'd', 'MarkerSize', 4, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  1856. %     hold on;
  1857. % end
  1858. %
  1859. % xlim([0 5]);
  1860. % ylim([0 size(V_P, 2)+1]);
  1861. % ax = gca;
  1862. % ax.XTick = [0:0.1:5];
  1863. % %ax.YTick = [0:sqrt(size(V, 2)):size(V, 2)];
  1864. % ax.YTick = [0:50:size(V_P, 2)];
  1865. % %xlabel('Time, s', 'FontSize', 20);
  1866. % ylabel('Neuron number', 'FontSize', 20);
  1867. % title(['Poissons neurons time spikes raster'], 'FontSize', 20);
  1868. % set(gca, 'FontSize', 15);
  1869. %
  1870. % subplot(3, 1, 3);
  1871. % %left_color = [0 0 0];
  1872. % %right_color = [1 0 0];
  1873. % %set(results_raster_V_fre_1, 'defaultAxesColorOrder', [left_color; right_color]);
  1874. % %set(gca, 'FontSize', 14);
  1875. % omega_cur = 0;
  1876. % omega_total = [];
  1877. % time_total = [];
  1878. % %yyaxis left;
  1879. % regular_V_P_spiking_counter = 0;
  1880. % for i = 1:size(V_P, 2)
  1881. % %i = 4;
  1882. %     V_P_p = V_P(:, i);
  1883. %     [pks, locs] = findpeaks(V_P_p, time_V_P, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  1884. %
  1885. %     for pks_counter = 1:size(pks, 1)
  1886. %         pks(pks_counter) = i;
  1887. %     end
  1888. %    
  1889. %     if isempty([pks, locs]) || size(pks, 1) == 1
  1890. %         omega_cur = 0;
  1891. %         omega_total = [omega_total omega_cur'];
  1892. %         %time_locs = time_V(locs);
  1893. %         time_locs = locs;
  1894. %         time_locs = time_locs(2:end);
  1895. %         %time_locs = time_locs(find(omega_cur'<=60));
  1896. %         time_total = [time_total time_locs'];
  1897. %         %plot(omega_cur, i, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  1898. %         %hold on;
  1899. %     end
  1900. %     if ~isempty([pks, locs]) && size(pks, 1) > 1
  1901. %         regular_V_P_spiking_counter = regular_V_P_spiking_counter + 1;
  1902. %         %omega_cur = 1./diff(time_V(locs));
  1903. %         omega_cur = 1./diff(locs);
  1904. %         %omega_cur = omega_cur(find(omega_cur'<=60));
  1905. %         omega_total = [omega_total omega_cur'];
  1906. %         %time_locs = time_V(locs);
  1907. %         time_locs = locs;
  1908. %         time_locs = time_locs(2:end);
  1909. %         %time_locs = time_locs(find(omega_cur'<=60));
  1910. %         time_total = [time_total time_locs'];
  1911. %         %plot(omega_cur, pks(2:end), 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  1912. %         %hold on;
  1913. %     end
  1914. %        
  1915. %     %if ~isempty([pks, locs])
  1916. %     if ~isempty([pks, locs]) && size(pks, 1) > 1
  1917. %         plot(time_locs, omega_cur,  '.-');
  1918. %         hold on;
  1919. %     end  
  1920. % end
  1921. %
  1922. % set(gca, 'FontSize', 14);
  1923. % grid on;
  1924. % xlim([0 5]);
  1925. % ylim([0 50]);
  1926. % ax = gca;
  1927. % ax.XTick = [0:0.1:5];
  1928. % ax.YTick = [0:5:50];
  1929. % %legend('<\nu_P_i>');
  1930. % xlabel('Time, s', 'FontSize', 14);
  1931. % ylabel('\nu, s^{-1}', 'FontSize', 14);
  1932. % title('\nu_P_i', 'FontSize', 15);
  1933. %
  1934. % saveas(gcf, 'results_V_P_Freq.png');
  1935. % %saveas(gcf, 'results_V_Freq', 'epsc');
  1936. % close(results_V_P_Freq);
  1937. % disp('results_V_P_Freq save');
  1938. %%%%%%%%%%%%% V_P Freq END %%%%%%%%%%%%%%
  1939.  
  1940. % results_Ca_V_Freq = figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  1941. % subplot(3, 1, 1);
  1942. % line([0, 60], [0.3, 0.3], 'Color', 'red', 'LineStyle', '--', 'LineWidth', 1);
  1943. % hold on;
  1944. % plot(time_Ca, Ca(:, :), 'LineWidth', 1);
  1945. % hold on;
  1946. % set(gca, 'FontSize', 14);
  1947. % grid on;
  1948. % xlim([0 60]);
  1949. % ylim([0 0.7]);
  1950. % ax = gca;
  1951. % ax.XTick = [0:2:60];
  1952. % %xlabel('Time, s', 'FontSize', 14);
  1953. % ylabel('[Ca^{2+}], \muM', 'FontSize', 14);
  1954. % title('[Ca^{2+}]_i(t)', 'FontSize', 15);
  1955. %
  1956. % subplot(3, 1, 2);
  1957. % plot(time_V, V(:, :), 'LineWidth', 1);
  1958. % set(gca, 'FontSize', 14);
  1959. % grid on;
  1960. % xlim([0 3]);
  1961. % ylim([-80 40]);
  1962. % ax = gca;
  1963. % ax.XTick = [0:0.1:3];
  1964. % %xlabel('Time, s', 'FontSize', 14);
  1965. % ylabel('V, mV', 'FontSize', 14);
  1966. % title('V_i(t)', 'FontSize', 15);
  1967. %
  1968. % % saveas(gcf, 'results_Ca_V.png');
  1969. % % %saveas(gcf, 'results_Ca_V', 'epsc');
  1970. % % close(results_Ca_V);
  1971. % % disp('results_Ca_V save');
  1972. % %%%%%%%%%%%%% End All Ca_V_i %%%%%%%%%%%%%%%%%%
  1973. % subplot(3, 1, 3);
  1974. %
  1975. % %left_color = [0 0 0];
  1976. % %right_color = [1 0 0];
  1977. % %set(results_raster_V_fre_1, 'defaultAxesColorOrder', [left_color; right_color]);
  1978. % %set(gca, 'FontSize', 14);
  1979. % omega_cur = 0;
  1980. % omega_total = [];
  1981. % time_total = [];
  1982. % %yyaxis left;
  1983. % regular_V_spiking_counter = 0;
  1984. % for i = 1:size(V, 2)
  1985. % %i = 4;
  1986. %     V_p = V(:, i);
  1987. %     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  1988. %
  1989. %     for pks_counter = 1:size(pks, 1)
  1990. %         pks(pks_counter) = i;
  1991. %     end
  1992. %    
  1993. %     if isempty([pks, locs]) || size(pks, 1) == 1
  1994. %         omega_cur = 0;
  1995. %         omega_total = [omega_total omega_cur'];
  1996. %         %time_locs = time_V(locs);
  1997. %         time_locs = locs;
  1998. %         time_locs = time_locs(2:end);
  1999. %         %time_locs = time_locs(find(omega_cur'<=60));
  2000. %         time_total = [time_total time_locs'];
  2001. %         %plot(omega_cur, i, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  2002. %         %hold on;
  2003. %     end
  2004. %     if ~isempty([pks, locs]) && size(pks, 1) > 1
  2005. %         regular_V_spiking_counter = regular_V_spiking_counter + 1;
  2006. %         %omega_cur = 1./diff(time_V(locs));
  2007. %         omega_cur = 1./diff(locs);
  2008. %         %omega_cur = omega_cur(find(omega_cur'<=60));
  2009. %         omega_total = [omega_total omega_cur'];
  2010. %         %time_locs = time_V(locs);
  2011. %         time_locs = locs;
  2012. %         time_locs = time_locs(2:end);
  2013. %         %time_locs = time_locs(find(omega_cur'<=60));
  2014. %         time_total = [time_total time_locs'];
  2015. %         %plot(omega_cur, pks(2:end), 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  2016. %         %hold on;
  2017. %     end
  2018. %    
  2019. %     %N_time_array(i, ismember(time, time_locs)) = omega_cur;
  2020. %     %N_time_array(i, ismember(round(time_V*1e5), round(time_locs*1e5))) = omega_cur;
  2021. %    
  2022. %     %if ~isempty([pks, locs])
  2023. %     if ~isempty([pks, locs]) && size(pks, 1) > 1
  2024. %         plot(time_locs, omega_cur,  '.-');
  2025. %         hold on;
  2026. %     end
  2027. % end
  2028. %
  2029. % set(gca, 'FontSize', 14);
  2030. % grid on;
  2031. % xlim([0 3]);
  2032. % ylim([0 40]);
  2033. % ax = gca;
  2034. % ax.XTick = [0:0.1:3];
  2035. % ax.YTick = [0:5:40];
  2036. % %legend('<\nu_i>');
  2037. % xlabel('Time, s', 'FontSize', 14);
  2038. % ylabel('\nu, s^{-1}', 'FontSize', 14);
  2039. % title('\nu_i', 'FontSize', 15);
  2040. %
  2041. % saveas(gcf, 'results_Ca_V_Freq.png');
  2042. % %saveas(gcf, 'results_V_Freq', 'epsc');
  2043. % close(results_Ca_V_Freq);
  2044. % disp('results_Ca_V_Freq save');
  2045.  
  2046. %%%%%%%%%%%%%%%%% Raster START %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2047. % filename2 = 'results_V_spikes.txt';
  2048. % path2 = '/Users/sergeymakovkin/Documents/Ring_Parall_Debian';
  2049. % Data = importdata( [ path2 '/' filename2 ] );
  2050. % time_Ca = Data(round(0.25*end):end, 1);
  2051. % time_V_Raster = Data(:, 1);
  2052. % Ca = Data(round(0.25*end):end, 2:end);
  2053. % V_Raster = Data(:, 2:end);
  2054. % time = Data(4800000:end, 1);
  2055. % Ca = Data(4800000:end, 2:end);
  2056. % clear Data;
  2057. % disp('results_V_spikes load complete');
  2058.  
  2059. N = size(V_m08, 2);
  2060. t_V_end = time_V(end);
  2061. %t_end = 40.0;
  2062. t_V_start = round(0.25*t_V_end);
  2063. dt = time_V(2) - time_V(1);
  2064. %dt = 0.00005;
  2065. %time_V = t_V_start:dt:t_V_end;
  2066. time_V = time_V';
  2067. N_time_V_array = zeros(N, numel(time_V));
  2068.  
  2069. t_Ca_end = time_Ca(end);
  2070. t_Ca_start = 0;
  2071. dt = time_Ca(2) - time_Ca(1);
  2072. time_Ca = t_Ca_start:dt:t_Ca_end;
  2073. time_Ca = time_Ca';
  2074. N_time_Ca_array = zeros(N, numel(time_Ca));
  2075.  
  2076. % results_raster_V_P_V_all = figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  2077. % subplot(2, 1, 1);
  2078. % %time_V_P = time_V_P';
  2079. % regular_V_P_spiking_counter = 0;
  2080. % for i = 1:size(V_P, 2)
  2081. %     %V_p = V(:, 1);
  2082. %     V_P_p = V_P(:, i);
  2083. %     [pks, locs] = findpeaks(V_P_p, time_V_P, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  2084. %     if ~isempty([pks, locs])
  2085. %         regular_V_P_spiking_counter = regular_V_P_spiking_counter + 1;
  2086. %     end
  2087. %     for pks_counter = 1:size(pks, 1)
  2088. %         pks(pks_counter) = i;
  2089. %     end
  2090. %     plot(locs, pks, 'd', 'MarkerSize', 4, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  2091. %     hold on;
  2092. %      
  2093. %     %N_time_V_array(i, ismember(round(time_V*1e5), round(locs*1e5))) = 1;
  2094. % end
  2095. %
  2096. % xlim([0 5]);
  2097. % ylim([0 size(V_P, 2)+1]);
  2098. % ax = gca;
  2099. % ax.XTick = [0:0.1:5];
  2100. % %ax.YTick = [0:sqrt(size(V, 2)):size(V, 2)];
  2101. % ax.YTick = [0:50:size(V_P, 2)];
  2102. % %xlabel('Time of spikes, s', 'FontSize', 20);
  2103. % ylabel('Neuron number', 'FontSize', 20);
  2104. % title(['Poissons neurons time spikes raster'], 'FontSize', 20);
  2105. % set(gca, 'FontSize', 18);
  2106. %
  2107. % % saveas(gcf, 'results_raster_V_P_all.png');
  2108. % % %saveas(gcf, 'results_raster_V_all', 'epsc');
  2109. % % close(results_raster_V_P_all);
  2110. % % %clear;
  2111. % % disp('results_raster_V_P_all save');
  2112. %
  2113. % %results_raster_V_all = figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  2114. % subplot(2, 1, 2);
  2115. % time_V = time_V';
  2116. % regular_V_spiking_counter = 0;
  2117. % for i = 1:size(V, 2)
  2118. %     %V_p = V(:, 1);
  2119. %     V_p = V(:, i);
  2120. %     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  2121. %     if ~isempty([pks, locs])
  2122. %         regular_V_spiking_counter = regular_V_spiking_counter + 1;
  2123. %     end
  2124. %     for pks_counter = 1:size(pks, 1)
  2125. %         pks(pks_counter) = i;
  2126. %     end
  2127. %     plot(locs, pks, 'd', 'MarkerSize', 4, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  2128. %     hold on;
  2129. %      
  2130. %     %N_time_V_array(i, ismember(round(time_V*1e5), round(locs*1e5))) = 1;
  2131. % end
  2132. %
  2133. % xlim([0 5]);
  2134. % ylim([0 size(V, 2)+1]);
  2135. % ax = gca;
  2136. % ax.XTick = [0:0.1:5];
  2137. % %ax.YTick = [0:sqrt(size(V, 2)):size(V, 2)];
  2138. % ax.YTick = [0:50:size(V, 2)];
  2139. % xlabel('Time of spikes, s', 'FontSize', 20);
  2140. % ylabel('Neuron number', 'FontSize', 20);
  2141. % title(['Neurons time spikes raster'], 'FontSize', 20);
  2142. % set(gca, 'FontSize', 18);
  2143. %
  2144. % saveas(gcf, 'results_raster_V_P_V_all.png');
  2145. % %saveas(gcf, 'results_raster_V_P_V_all', 'epsc');
  2146. % close(results_raster_V_P_V_all);
  2147. % %clear;
  2148. % disp('results_raster_V_P_V_all save');
  2149.  
  2150. filename1 = 'corr_not_zero_g_astro_m08_01.txt';
  2151. path1 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  2152. Data1 = importdata( [ path1 '/' filename1 ] );
  2153. time_k_syn = Data1(:, 1);
  2154. k_syn1_m08 = Data1(:, 2);
  2155.  
  2156. filename2 = 'corr_not_zero_g_astro_m08_02.txt';
  2157. path2 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  2158. Data2 = importdata( [ path2 '/' filename2 ] );
  2159. time_k_syn = Data2(:, 1);
  2160. k_syn2_m08 = Data2(:, 2);
  2161.  
  2162. filename3 = 'corr_not_zero_g_astro_m08_03.txt';
  2163. path3 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  2164. Data3 = importdata( [ path3 '/' filename3 ] );
  2165. time_k_syn = Data3(:, 1);
  2166. k_syn3_m08 = Data3(:, 2);
  2167.  
  2168. filename4 = 'corr_not_zero_g_astro_m08_04.txt';
  2169. path4 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  2170. Data4 = importdata( [ path4 '/' filename4 ] );
  2171. time_k_syn = Data4(:, 1);
  2172. k_syn4_m08 = Data4(:, 2);
  2173.  
  2174. filename5 = 'corr_not_zero_g_astro_m08_05.txt';
  2175. path5 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  2176. Data5 = importdata( [ path5 '/' filename5 ] );
  2177. time_k_syn = Data5(:, 1);
  2178. k_syn5_m08 = Data5(:, 2);
  2179.  
  2180. filename6 = 'corr_not_zero_g_astro_m08_06.txt';
  2181. path6 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  2182. Data6 = importdata( [ path6 '/' filename6 ] );
  2183. time_k_syn = Data6(:, 1);
  2184. k_syn6_m08 = Data6(:, 2);
  2185.  
  2186. filename7 = 'corr_not_zero_g_astro_m08_07.txt';
  2187. path7 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  2188. Data7 = importdata( [ path7 '/' filename7 ] );
  2189. time_k_syn = Data7(:, 1);
  2190. k_syn7_m08 = Data7(:, 2);
  2191.  
  2192. filename8 = 'corr_not_zero_g_astro_m08_08.txt';
  2193. path8 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  2194. Data8 = importdata( [ path8 '/' filename8 ] );
  2195. time_k_syn = Data8(:, 1);
  2196. k_syn8_m08 = Data8(:, 2);
  2197.  
  2198. filename9 = 'corr_not_zero_g_astro_m08_09.txt';
  2199. path9 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  2200. Data9 = importdata( [ path9 '/' filename9 ] );
  2201. time_k_syn = Data9(:, 1);
  2202. k_syn9_m08 = Data9(:, 2);
  2203.  
  2204. filename10 = 'corr_not_zero_g_astro_m08_10.txt';
  2205. path10 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  2206. Data10 = importdata( [ path10 '/' filename10 ] );
  2207. time_k_syn = Data10(:, 1);
  2208. k_syn10_m08 = Data10(:, 2);
  2209.  
  2210. k_syn_m08 = mean([k_syn1_m08, k_syn2_m08, k_syn3_m08, k_syn4_m08, k_syn5_m08, k_syn6_m08, k_syn7_m08, k_syn8_m08, k_syn9_m08, k_syn10_m08], 2);
  2211.  
  2212. disp('results_k_syn_m08 load complete');
  2213. %%%%
  2214.  
  2215. filename1 = 'corr_not_zero_g_astro_10_01.txt';
  2216. path1 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  2217. Data1 = importdata( [ path1 '/' filename1 ] );
  2218. time_k_syn = Data1(:, 1);
  2219. k_syn1_10 = Data1(:, 2);
  2220.  
  2221. filename2 = 'corr_not_zero_g_astro_10_02.txt';
  2222. path2 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  2223. Data2 = importdata( [ path2 '/' filename2 ] );
  2224. time_k_syn = Data2(:, 1);
  2225. k_syn2_10 = Data2(:, 2);
  2226.  
  2227. filename3 = 'corr_not_zero_g_astro_10_03.txt';
  2228. path3 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  2229. Data3 = importdata( [ path3 '/' filename3 ] );
  2230. time_k_syn = Data3(:, 1);
  2231. k_syn3_10 = Data3(:, 2);
  2232.  
  2233. filename4 = 'corr_not_zero_g_astro_10_04.txt';
  2234. path4 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  2235. Data4 = importdata( [ path4 '/' filename4 ] );
  2236. time_k_syn = Data4(:, 1);
  2237. k_syn4_10 = Data4(:, 2);
  2238.  
  2239. filename5 = 'corr_not_zero_g_astro_10_05.txt';
  2240. path5 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  2241. Data5 = importdata( [ path5 '/' filename5 ] );
  2242. time_k_syn = Data5(:, 1);
  2243. k_syn5_10 = Data5(:, 2);
  2244.  
  2245. filename6 = 'corr_not_zero_g_astro_10_06.txt';
  2246. path6 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  2247. Data6 = importdata( [ path6 '/' filename6 ] );
  2248. time_k_syn = Data6(:, 1);
  2249. k_syn6_10 = Data6(:, 2);
  2250.  
  2251. filename7 = 'corr_not_zero_g_astro_10_07.txt';
  2252. path7 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  2253. Data7 = importdata( [ path7 '/' filename7 ] );
  2254. time_k_syn = Data7(:, 1);
  2255. k_syn7_10 = Data7(:, 2);
  2256.  
  2257. filename8 = 'corr_not_zero_g_astro_10_08.txt';
  2258. path8 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  2259. Data8 = importdata( [ path8 '/' filename8 ] );
  2260. time_k_syn = Data8(:, 1);
  2261. k_syn8_10 = Data8(:, 2);
  2262.  
  2263. filename9 = 'corr_not_zero_g_astro_10_09.txt';
  2264. path9 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  2265. Data9 = importdata( [ path9 '/' filename9 ] );
  2266. time_k_syn = Data9(:, 1);
  2267. k_syn9_10 = Data9(:, 2);
  2268.  
  2269. filename10 = 'corr_not_zero_g_astro_10_10.txt';
  2270. path10 = '/Users/sergeymakovkin/Documents/3_Rings/Ver_2_2021_03_09';
  2271. Data10 = importdata( [ path10 '/' filename10 ] );
  2272. time_k_syn = Data10(:, 1);
  2273. k_syn10_10 = Data10(:, 2);
  2274.  
  2275. k_syn_10 = mean([k_syn1_10, k_syn2_10, k_syn3_10, k_syn4_10, k_syn5_10, k_syn6_10, k_syn7_10, k_syn8_10, k_syn9_10, k_syn10_10], 2);
  2276.  
  2277. disp('results_k_syn_10 load complete');
  2278.  
  2279. % results_k_syn_only = figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  2280. % plot(time_k_syn, k_syn, 'LineWidth', 1);
  2281. % hold on;
  2282. % set(gca, 'FontSize', 14);
  2283. % grid on;
  2284. % xlim([0 60]);
  2285. % ylim([0 1.0]);
  2286. % ax = gca;
  2287. % ax.XTick = [0:2:60];
  2288. % ax = gca;
  2289. % ax.YTick = [0:0.1:1.0];
  2290. % xlabel('Time, s', 'FontSize', 14);
  2291. % ylabel('k_{syn}', 'FontSize', 14);
  2292. % title('k_{syn}', 'FontSize', 14);
  2293. % set(gca, 'FontSize', 14)
  2294. % saveas(gcf, 'results_k_syn_only.png');
  2295. % %saveas(gcf, 'results_k_syn_only', 'epsc');
  2296. % close(results_k_syn_only);
  2297. % disp('results_k_syn_only save');
  2298.  
  2299. % results_raster_Ca_V_all = figure('units', 'normalized', 'outerposition', [0 0 0.6 1], 'visible', 'on');
  2300. % subplot(8, 2, [1 2]);
  2301. % line([0, 60], [0.3, 0.3], 'Color', 'red', 'LineStyle', '--', 'LineWidth', 1);
  2302. % hold on;
  2303. % plot(time_Ca, Ca(:, :), 'LineWidth', 1);
  2304. % hold on;
  2305. % set(gca, 'FontSize', 14);
  2306. % grid on;
  2307. % xlim([0 60]);
  2308. % ylim([0 0.7]);
  2309. % ax = gca;
  2310. % ax.XTick = [0:2:60];
  2311. % ax = gca;
  2312. % ax.YTick = [0:0.1:0.7];
  2313. % %xlabel('Time, sec', 'FontSize', 14);
  2314. % ylabel('[Ca^{2+}], (\muM)', 'FontSize', 14);
  2315. % title('[Ca^{2+}]_i(t)', 'FontSize', 14);
  2316. % set(gca, 'FontSize', 12);
  2317. %
  2318. % subplot(8, 2, [3 4]);
  2319. % regular_Ca_spiking_counter = 0;
  2320. % for i = 1:size(Ca, 2)
  2321. %     Ca_p = Ca(:, i);
  2322. %     [pks, locs] = findpeaks(Ca_p, 'MinPeakHeight', 0.3);
  2323. %     if ~isempty([pks, locs])
  2324. %         regular_Ca_spiking_counter = regular_Ca_spiking_counter + 1;
  2325. %     end
  2326. %     for pks_counter = 1:size(pks, 1)
  2327. %         pks(pks_counter) = i;
  2328. %     end
  2329. %     plot(time_Ca(locs), pks, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  2330. %     hold on;
  2331. %    
  2332. %     N_time_Ca_array(i, ismember(round(time_Ca*1e5), round(time_Ca(locs)*1e5))) = 1;
  2333. % end
  2334. % xlim([0 60]);
  2335. % ylim([0 size(Ca, 2)+1]);
  2336. % ax = gca;
  2337. % ax.XTick = [0:2:60];
  2338. % %ax.YTick = [0:sqrt(size(V, 2)):size(V, 2)];
  2339. % ax.YTick = [0:50:size(Ca, 2)];
  2340. % %xlabel('Time of spikes, sec', 'FontSize', 20);
  2341. % ylabel('Astrocyte number', 'FontSize', 20);
  2342. % title(['Astrocytes time spikes raster'], 'FontSize', 20);
  2343. % set(gca, 'FontSize', 12);
  2344. %
  2345. % subplot(8, 2, [5 6]);
  2346. % dt_Ca_shift = 2.0; % sec
  2347. % k_Ca = round(dt_Ca_shift / dt);
  2348. %
  2349. % total_spykes_Ca = zeros(1, size(N_time_Ca_array, 2));
  2350. % for i = 1:size(V, 2)
  2351. %     total_spykes_Ca = total_spykes_Ca + N_time_Ca_array(i, :);
  2352. % end
  2353. % Count_shift_Ca_sum = movsum(total_spykes_Ca, k_Ca);
  2354. %
  2355. % % Count_shift_sum = zeros(1, size(N_time_V_array, 2));
  2356. % % for i = 1:size(V, 2)
  2357. % %     Count_shift = movsum(N_time_V_array(i, :), k);
  2358. % %     Count_shift_sum = Count_shift_sum + Count_shift;    
  2359. % % end
  2360. %
  2361. % % figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  2362. % % plot(time_Ca, total_spykes_Ca, '-');
  2363. % % xlim([10 40]);
  2364. %
  2365. % %figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  2366. % plot(time_Ca, Count_shift_Ca_sum, 'r-', 'LineWidth', 1);
  2367. % xlim([0 60]);
  2368. % ylim([0 size(Ca, 2)]);
  2369. % ax = gca;
  2370. % ax.XTick = [0:2:60];
  2371. % ax.YTick = [0:50:size(Ca, 2)];
  2372. % title(['Astrocytes slide window spikes sum'], 'FontSize', 12);
  2373. % ylabel('Shift sum', 'FontSize', 12);
  2374. % %xlabel('Time of spikes, sec', 'FontSize', 12);
  2375. % set(gca, 'FontSize', 12);
  2376. %
  2377. % subplot(8, 2, [7 8]);
  2378. % %time_V = time_V';
  2379. % omega_cur = 0;
  2380. % omega_total = [];
  2381. % time_total = [];
  2382. % %yyaxis left;
  2383. % regular_V_spiking_counter = 0;
  2384. % for i = 1:size(V, 2)
  2385. % %i = 24;
  2386. %     V_p = V(:, i);
  2387. %     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  2388. %    
  2389. %     for pks_counter = 1:size(pks, 1)
  2390. %         pks(pks_counter) = i;
  2391. %     end
  2392. %
  2393. %     if isempty([pks, locs]) || size(pks, 1) == 1
  2394. %         omega_cur = 0;
  2395. %         omega_total = [omega_total omega_cur'];
  2396. %         time_locs = locs;
  2397. %         time_locs = time_locs(2:end);
  2398. %         %time_locs = time_locs(find(omega_cur'<=60));
  2399. %         time_total = [time_total time_locs'];
  2400. %         %plot(omega_cur, i, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  2401. %         %hold on;
  2402. %     end
  2403. %     if ~isempty([pks, locs]) && size(pks, 1) > 1
  2404. %         regular_V_spiking_counter = regular_V_spiking_counter + 1;
  2405. %         omega_cur = 1./diff(locs);
  2406. %         %omega_cur = omega_cur(find(omega_cur'<=60));
  2407. %         omega_total = [omega_total omega_cur'];
  2408. %         time_locs = locs;
  2409. %         time_locs = time_locs(2:end);
  2410. %         %time_locs = time_locs(find(omega_cur'<=60));
  2411. %         time_total = [time_total time_locs'];
  2412. %         %plot(omega_cur, pks(2:end), 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  2413. %         %hold on;
  2414. %     end
  2415. %    
  2416. %     if ~isempty([pks, locs]) && size(pks, 1) > 1
  2417. %         plot(time_locs, omega_cur,  '.-');
  2418. %         hold on;
  2419. %     end
  2420. % end
  2421. %
  2422. % set(gca, 'FontSize', 12);
  2423. % grid on;
  2424. % xlim([0 60]);
  2425. % ylim([0 40]);
  2426. % ax = gca;
  2427. % ax.XTick = [0:2:60];
  2428. % ax.YTick = [0:5:40];
  2429. % %legend('<\nu_i>');
  2430. % %xlabel('Time, sec', 'FontSize', 12);
  2431. % ylabel('\nu, s^{-1}', 'FontSize', 12);
  2432. % title('Neurons frequencies, \nu_i', 'FontSize', 12);
  2433. % time_V = time_V';
  2434. %
  2435. % subplot(8, 2, [9 10]);
  2436. % plot(time_k_syn, k_syn, 'LineWidth', 1);
  2437. % hold on;
  2438. % set(gca, 'FontSize', 14);
  2439. % grid on;
  2440. % xlim([0 60]);
  2441. % ylim([0 1.0]);
  2442. % ax = gca;
  2443. % ax.XTick = [0:2:60];
  2444. % ax = gca;
  2445. % ax.YTick = [0:0.2:1.0];
  2446. % %xlabel('Time, s', 'FontSize', 12);
  2447. % ylabel('k_{syn}', 'FontSize', 12);
  2448. % title('k_{syn}', 'FontSize', 14);
  2449. % set(gca, 'FontSize', 12);
  2450. %
  2451. % subplot(8, 2, 11);
  2452. % plot(time_V, V(:, :), 'LineWidth', 1);
  2453. % set(gca, 'FontSize', 12);
  2454. % grid on;
  2455. % xlim([15 16]);
  2456. % ylim([-80 40]);
  2457. % ax = gca;
  2458. % ax.XTick = [15:0.1:16];
  2459. % ax.YTick = [-80:40:40];
  2460. % %xlabel('Time, sec', 'FontSize', 12);
  2461. % ylabel('V, mV', 'FontSize', 12);
  2462. % title('V_i(t)', 'FontSize', 12);
  2463. % set(gca, 'FontSize', 12);
  2464. %
  2465. % subplot(8, 2, 13);
  2466. % time_V = time_V';
  2467. % regular_V_spiking_counter = 0;
  2468. % for i = 1:size(V, 2)
  2469. %     %V_p = V(:, 1);
  2470. %     V_p = V(:, i);
  2471. %     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  2472. %     if ~isempty([pks, locs])
  2473. %         regular_V_spiking_counter = regular_V_spiking_counter + 1;
  2474. %     end
  2475. %     for pks_counter = 1:size(pks, 1)
  2476. %         pks(pks_counter) = i;
  2477. %     end
  2478. %     plot(locs, pks, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  2479. %     hold on;
  2480. %      
  2481. %     N_time_V_array(i, ismember(round(time_V*1e5), round(locs*1e5))) = 1;
  2482. % end
  2483. %
  2484. % xlim([15 16]);
  2485. % ylim([0 size(V, 2)+1]);
  2486. % ax = gca;
  2487. % ax.XTick = [15:0.1:16];
  2488. % %ax.YTick = [0:sqrt(size(V, 2)):size(V, 2)];
  2489. % ax.YTick = [0:50:size(V, 2)];
  2490. % %xlabel('Time of spikes, sec', 'FontSize', 20);
  2491. % ylabel('Neuron number', 'FontSize', 20);
  2492. % title(['Neurons time spikes raster'], 'FontSize', 20);
  2493. % set(gca, 'FontSize', 12);
  2494. %
  2495. % subplot(8, 2, 15);
  2496. % dt_V_shift = 0.030; % sec
  2497. % k_V = round(dt_V_shift / dt);
  2498. %
  2499. % total_spykes = zeros(1, size(N_time_V_array, 2));
  2500. % for i = 1:size(V, 2)
  2501. %     total_spykes = total_spykes + N_time_V_array(i, :);
  2502. % end
  2503. % Count_shift_sum = movsum(total_spykes, k_V);
  2504. %
  2505. % % Count_shift_sum = zeros(1, size(N_time_V_array, 2));
  2506. % % for i = 1:size(V, 2)
  2507. % %     Count_shift = movsum(N_time_V_array(i, :), k);
  2508. % %     Count_shift_sum = Count_shift_sum + Count_shift;    
  2509. % % end
  2510. %
  2511. % % figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  2512. % % plot(time_V, total_spykes, '-');
  2513. % % xlim([10 20]);
  2514. %
  2515. % %figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  2516. % plot(time_V, Count_shift_sum, 'b-');
  2517. % xlim([15 16]);
  2518. % ylim([0 size(V, 2)+1]);
  2519. % ax = gca;
  2520. % ax.XTick = [15:0.1:16];
  2521. % ax.YTick = [0:50:size(V, 2)];
  2522. % title(['Neurons slide window spikes sum'], 'FontSize', 12);
  2523. % xlabel('Time, s', 'FontSize', 12);
  2524. % ylabel('Shift sum', 'FontSize', 12);
  2525. % set(gca, 'FontSize', 12);
  2526. %
  2527. % subplot(8, 2, 12);
  2528. % plot(time_V, V(:, :), 'LineWidth', 1);
  2529. % set(gca, 'FontSize', 12);
  2530. % grid on;
  2531. % xlim([19 20]);
  2532. % ylim([-80 40]);
  2533. % ax = gca;
  2534. % ax.XTick = [19:0.1:20];
  2535. % ax.YTick = [-80:40:40];
  2536. % %xlabel('Time, sec', 'FontSize', 12);
  2537. % ylabel('V, mV', 'FontSize', 12);
  2538. % title('V_i(t)', 'FontSize', 12);
  2539. % set(gca, 'FontSize', 12);
  2540. %
  2541. % subplot(8, 2, 14);
  2542. % regular_V_spiking_counter = 0;
  2543. % for i = 1:size(V, 2)
  2544. %     %V_p = V(:, 1);
  2545. %     V_p = V(:, i);
  2546. %     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  2547. %     if ~isempty([pks, locs])
  2548. %         regular_V_spiking_counter = regular_V_spiking_counter + 1;
  2549. %     end
  2550. %     for pks_counter = 1:size(pks, 1)
  2551. %         pks(pks_counter) = i;
  2552. %     end
  2553. %     plot(locs, pks, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  2554. %     hold on;
  2555. %      
  2556. %     N_time_V_array(i, ismember(round(time_V*1e5), round(locs*1e5))) = 1;
  2557. % end
  2558. %
  2559. % xlim([19 20]);
  2560. % ylim([0 size(V, 2)+1]);
  2561. % ax = gca;
  2562. % ax.XTick = [19:0.1:20];
  2563. % %ax.YTick = [0:sqrt(size(V, 2)):size(V, 2)];
  2564. % ax.YTick = [0:50:size(V, 2)];
  2565. % %xlabel('Time of spikes, sec', 'FontSize', 20);
  2566. % ylabel('Neuron number', 'FontSize', 20);
  2567. % title(['Neurons time spikes raster'], 'FontSize', 20);
  2568. % set(gca, 'FontSize', 12);
  2569. %
  2570. % subplot(8, 2, 16);
  2571. % dt_V_shift = 0.030; % sec
  2572. % k_V = round(dt_V_shift / dt);
  2573. %
  2574. % total_spykes = zeros(1, size(N_time_V_array, 2));
  2575. % for i = 1:size(V, 2)
  2576. %     total_spykes = total_spykes + N_time_V_array(i, :);
  2577. % end
  2578. % Count_shift_sum = movsum(total_spykes, k_V);
  2579. %
  2580. % % Count_shift_sum = zeros(1, size(N_time_V_array, 2));
  2581. % % for i = 1:size(V, 2)
  2582. % %     Count_shift = movsum(N_time_V_array(i, :), k);
  2583. % %     Count_shift_sum = Count_shift_sum + Count_shift;    
  2584. % % end
  2585. %
  2586. % % figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  2587. % % plot(time_V, total_spykes, '-');
  2588. % % xlim([10 20]);
  2589. %
  2590. % %figure('units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on');
  2591. % plot(time_V, Count_shift_sum, 'b-');
  2592. % xlim([19 20]);
  2593. % ylim([0 size(V, 2)+1]);
  2594. % ax = gca;
  2595. % ax.XTick = [19:0.1:20];
  2596. % ax.YTick = [0:50:size(V, 2)];
  2597. % title(['Neurons slide window spikes sum'], 'FontSize', 12);
  2598. % xlabel('Time, s', 'FontSize', 12);
  2599. % ylabel('Shift sum', 'FontSize', 12);
  2600. % set(gca, 'FontSize', 12);
  2601. %
  2602. % saveas(gcf, 'results_raster_Ca_V_all.png');
  2603. % %saveas(gcf, 'results_raster_V_all', 'epsc');
  2604. % close(results_raster_Ca_V_all);
  2605. % %clear;
  2606. % disp('results_raster_Ca_V_all save');
  2607.  
  2608. %%%%%%%%%%%%%%%%%%%%%
  2609. % results_presentation_raster_Ca_V_all = figure('units', 'normalized', 'outerposition', [0 0 0.6 1], 'visible', 'on');
  2610. % subplot(5, 2, [1 2]);
  2611. % line([0, 60], [0.3, 0.3], 'Color', 'red', 'LineStyle', '--', 'LineWidth', 1);
  2612. % hold on;
  2613. % plot(time_Ca, Ca(:, :), 'LineWidth', 1);
  2614. % hold on;
  2615. % rectangle('Position',[33 0 1 0.7], 'FaceColor', [0.0 1.0 0.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  2616. % hold on;
  2617. % rectangle('Position',[37 0 1 0.7], 'FaceColor', [0.0 1.0 1.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  2618. % hold on;
  2619. % %grid on;
  2620. % xlim([24 50]);
  2621. % ylim([0 0.7]);
  2622. % ax = gca;
  2623. % ax.XTick = [0:2:60];
  2624. % ax = gca;
  2625. % ytickformat('%.1f');
  2626. % set(gca, 'YTick', [0.0 : 0.2 : 0.7]);
  2627. % %xlabel('Time, sec', 'FontSize', 14);
  2628. % ylabel('[Ca^{2+}], \muM', 'FontSize', 18);
  2629. % title('[Ca^{2+}]_i(t)', 'FontSize', 18);
  2630. % box on;
  2631. % set(gca, 'FontSize', 18);
  2632. %
  2633. % subplot(5, 2, [3 4]);
  2634. % %time_V = time_V';
  2635. % omega_cur = 0;
  2636. % omega_total = [];
  2637. % time_total = [];
  2638. % %yyaxis left;
  2639. % regular_V_spiking_counter = 0;
  2640. % for i = 1:size(V, 2)
  2641. % %i = 24;
  2642. %     V_p = V(:, i);
  2643. %     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  2644. %    
  2645. %     for pks_counter = 1:size(pks, 1)
  2646. %         pks(pks_counter) = i;
  2647. %     end
  2648. %
  2649. %     if isempty([pks, locs]) || size(pks, 1) == 1
  2650. %         omega_cur = 0;
  2651. %         omega_total = [omega_total omega_cur'];
  2652. %         time_locs = locs;
  2653. %         time_locs = time_locs(2:end);
  2654. %         %time_locs = time_locs(find(omega_cur'<=60));
  2655. %         time_total = [time_total time_locs'];
  2656. %         %plot(omega_cur, i, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  2657. %         %hold on;
  2658. %     end
  2659. %     if ~isempty([pks, locs]) && size(pks, 1) > 1
  2660. %         regular_V_spiking_counter = regular_V_spiking_counter + 1;
  2661. %         omega_cur = 1./diff(locs);
  2662. %         %omega_cur = omega_cur(find(omega_cur'<=60));
  2663. %         omega_total = [omega_total omega_cur'];
  2664. %         time_locs = locs;
  2665. %         time_locs = time_locs(2:end);
  2666. %         %time_locs = time_locs(find(omega_cur'<=60));
  2667. %         time_total = [time_total time_locs'];
  2668. %         %plot(omega_cur, pks(2:end), 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  2669. %         %hold on;
  2670. %     end
  2671. %    
  2672. %     if ~isempty([pks, locs]) && size(pks, 1) > 1
  2673. %         plot(time_locs, omega_cur,  '.-');
  2674. %         hold on;
  2675. %     end
  2676. % end
  2677. %
  2678. % set(gca, 'FontSize', 18);
  2679. % %grid on;
  2680. % rectangle('Position',[33 0 1 60], 'FaceColor', [0.0 1.0 0.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  2681. % hold on;
  2682. % rectangle('Position',[37 0 1 60], 'FaceColor', [0.0 1.0 1.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  2683. % hold on;
  2684. % xlim([24 50]);
  2685. % ylim([0 50]);
  2686. % ax = gca;
  2687. % ax.XTick = [0:2:60];
  2688. % ax.YTick = [0:10:50];
  2689. % %legend('<\nu_i>');
  2690. % %xlabel('Time, sec', 'FontSize', 12);
  2691. % ylabel('\nu, s^{-1}', 'FontSize', 18);
  2692. % title('Neurons frequencies, \nu_i', 'FontSize', 18);
  2693. % box on;
  2694. % time_V = time_V';
  2695. %
  2696. % subplot(5, 2, [5 6]);
  2697. % plot(time_k_syn, k_syn, 'LineWidth', 2);
  2698. % hold on;
  2699. % rectangle('Position',[33 0 1 1.0], 'FaceColor', [0.0 1.0 0.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  2700. % hold on;
  2701. % rectangle('Position',[37 0 1 1.0], 'FaceColor', [0.0 1.0 1.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  2702. % hold on;
  2703. % %grid on;
  2704. % xlim([24 50]);
  2705. % ylim([0 1.0]);
  2706. % ax = gca;
  2707. % ax.XTick = [0:2:60];
  2708. % ax = gca;
  2709. % ytickformat('%.1f');
  2710. % set(gca, 'YTick', [0.0 : 0.2 : 1.0]);
  2711. % %ax.YTick = [0:0.25:1.0];
  2712. % xlabel('Time, s', 'FontSize', 18);
  2713. % ylabel('k_{syn}', 'FontSize', 18);
  2714. % title('<k_{syn}>', 'FontSize', 18);
  2715. % box on;
  2716. % set(gca, 'FontSize', 18);
  2717. %
  2718. % subplot(5, 2, 7);
  2719. % plot(time_V, V(:, :), 'LineWidth', 1);
  2720. % hold on;
  2721. % rectangle('Position',[33 -80 1 120], 'EdgeColor', '[0.0 1.0 0.0 0.5]', 'LineWidth', 3);
  2722. % hold on;
  2723. % box on;
  2724. % %grid on;
  2725. % xlim([33 34]);
  2726. % ylim([-80 40]);
  2727. % ax = gca;
  2728. % xtickformat('%.1f');
  2729. % set(gca, 'XTick', [33:0.2:34]);
  2730. % ax.YTick = [-80:40:40];
  2731. % %xlabel('Time, sec', 'FontSize', 12);
  2732. % ylabel('V, mV', 'FontSize', 18);
  2733. % title('V_i(t)', 'FontSize', 18);
  2734. % set(gca, 'FontSize', 18);
  2735. %
  2736. % subplot(5, 2, 9);
  2737. % time_V = time_V';
  2738. % regular_V_spiking_counter = 0;
  2739. % for i = 1:size(V, 2)
  2740. %     %V_p = V(:, 1);
  2741. %     V_p = V(:, i);
  2742. %     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  2743. %     if ~isempty([pks, locs])
  2744. %         regular_V_spiking_counter = regular_V_spiking_counter + 1;
  2745. %     end
  2746. %     for pks_counter = 1:size(pks, 1)
  2747. %         pks(pks_counter) = i;
  2748. %     end
  2749. %     plot(locs, pks, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  2750. %     hold on;
  2751. %      
  2752. %     N_time_V_array(i, ismember(round(time_V*1e5), round(locs*1e5))) = 1;
  2753. % end
  2754. %
  2755. % xlim([33 34]);
  2756. % ylim([0 size(V, 2)+1]);
  2757. % rectangle('Position',[33, 0, 1, 201], 'EdgeColor', '[0.0 1.0 0.0 0.5]', 'LineWidth', 3);
  2758. % hold on;
  2759. % box on;
  2760. % ax = gca;
  2761. % ax = gca;
  2762. % xtickformat('%.1f');
  2763. % set(gca, 'XTick', [33:0.2:34]);
  2764. % %ax.YTick = [0:sqrt(size(V, 2)):size(V, 2)];
  2765. % ax.YTick = [0:100:size(V, 2)];
  2766. % xlabel('Time, s', 'FontSize', 18);
  2767. % ylabel('Neuron #', 'FontSize', 18);
  2768. % title(['Neurons time spikes raster'], 'FontSize', 18);
  2769. % set(gca, 'FontSize', 18);
  2770. %
  2771. % subplot(5, 2, 8);
  2772. % plot(time_V, V(:, :), 'LineWidth', 1);
  2773. % set(gca, 'FontSize', 18);
  2774. % %grid on;
  2775. % xlim([37 38]);
  2776. % ylim([-80 40]);
  2777. % ax = gca;
  2778. % ax = gca;
  2779. % xtickformat('%.1f');
  2780. % set(gca, 'XTick', [37:0.2:38]);
  2781. % ax.YTick = [-80:40:40];
  2782. % rectangle('Position',[37, -80, 1, 120], 'EdgeColor', '[0.0 1.0 1.0 0.5]', 'LineWidth', 3);
  2783. % hold on;
  2784. % box on;
  2785. % %xlabel('Time, sec', 'FontSize', 12);
  2786. % ylabel('V, mV', 'FontSize', 18);
  2787. % title('V_i(t)', 'FontSize', 18);
  2788. % set(gca, 'FontSize', 18);
  2789. %
  2790. % subplot(5, 2, 10);
  2791. % regular_V_spiking_counter = 0;
  2792. % for i = 1:size(V, 2)
  2793. %     %V_p = V(:, 1);
  2794. %     V_p = V(:, i);
  2795. %     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  2796. %     if ~isempty([pks, locs])
  2797. %         regular_V_spiking_counter = regular_V_spiking_counter + 1;
  2798. %     end
  2799. %     for pks_counter = 1:size(pks, 1)
  2800. %         pks(pks_counter) = i;
  2801. %     end
  2802. %     plot(locs, pks, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  2803. %     hold on;
  2804. %      
  2805. %     N_time_V_array(i, ismember(round(time_V*1e5), round(locs*1e5))) = 1;
  2806. % end
  2807. %
  2808. % xlim([37 38]);
  2809. % ylim([0 size(V, 2)+1]);
  2810. % rectangle('Position',[37, 0, 1, 201], 'EdgeColor', '[0.0 1.0 1.0 0.5]', 'LineWidth', 3);
  2811. % hold on;
  2812. % box on;
  2813. % ax = gca;
  2814. % xtickformat('%.1f');
  2815. % set(gca, 'XTick', [37:0.2:38]);
  2816. % %ax.YTick = [0:sqrt(size(V, 2)):size(V, 2)];
  2817. % ax.YTick = [0:100:size(V, 2)];
  2818. % xlabel('Time, s', 'FontSize', 18);
  2819. % ylabel('Neuron #', 'FontSize', 18);
  2820. % title(['Neurons time spikes raster'], 'FontSize', 18);
  2821. % set(gca, 'FontSize', 18);
  2822. %
  2823. % saveas(gcf, 'results_presentation_raster_Ca_V_all.png');
  2824. % saveas(gcf, 'results_presentation_raster_Ca_V_all', 'epsc');
  2825. % %savefig(results_paper_raster_Ca_V_all,  'results_paper_raster_Ca_V_all.fig')
  2826. % close(results_presentation_raster_Ca_V_all);
  2827. % %clear;
  2828. % disp('results_presentation_raster_Ca_V_all save');
  2829. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2830. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2831.  
  2832. %m08
  2833. results_paper_raster_Ca_V_all_A_m08 = figure('units', 'normalized', 'outerposition', [0 0 0.53 1], 'visible', 'on');
  2834. subplot(4, 2, [1 2]);
  2835. line([0, 60], [0.3, 0.3], 'Color', 'red', 'LineStyle', '--', 'LineWidth', 1);
  2836. hold on;
  2837. plot(time_Ca, Ca_m08(:, :), 'LineWidth', 1);
  2838. hold on;
  2839. rectangle('Position',[33 0 1 0.7], 'FaceColor', [0.0 1.0 0.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  2840. hold on;
  2841. rectangle('Position',[37 0 1 0.7], 'FaceColor', [0.0 1.0 1.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  2842. hold on;
  2843. %grid on;
  2844. xlim([24 50]);
  2845. ylim([0 0.7]);
  2846. ax = gca;
  2847. ax.XTick = [0:2:60];
  2848. ax = gca;
  2849. ytickformat('%.1f');
  2850. set(gca, 'YTick', [0.0 : 0.2 : 0.7]);
  2851. %xlabel('Time, sec', 'FontSize', 14);
  2852. ylabel('[Ca^{2+}], \muM', 'FontSize', 20);
  2853. title('a)', 'FontSize', 20);
  2854. box on;
  2855. set(gca, 'FontSize', 20);
  2856.  
  2857. subplot(4, 2, [3 4]);
  2858. if (size(time_V, 2) > size(time_V, 1))
  2859.     time_V = time_V';
  2860. end
  2861. omega_cur = 0;
  2862. omega_total = [];
  2863. time_total = [];
  2864. %yyaxis left;
  2865. regular_V_m08_spiking_counter = 0;
  2866. for i = 1:size(V_m08, 2)
  2867. %i = 24;
  2868.     V_p = V_m08(:, i);
  2869.     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  2870.    
  2871.     for pks_counter = 1:size(pks, 1)
  2872.         pks(pks_counter) = i;
  2873.     end
  2874.  
  2875.     if isempty([pks, locs]) || size(pks, 1) == 1
  2876.         omega_cur = 0;
  2877.         omega_total = [omega_total omega_cur'];
  2878.         time_locs = locs;
  2879.         time_locs = time_locs(2:end);
  2880.         %time_locs = time_locs(find(omega_cur'<=60));
  2881.         time_total = [time_total time_locs'];
  2882.         %plot(omega_cur, i, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  2883.         %hold on;
  2884.     end
  2885.     if ~isempty([pks, locs]) && size(pks, 1) > 1
  2886.         regular_V_m08_spiking_counter = regular_V_m08_spiking_counter + 1;
  2887.         omega_cur = 1./diff(locs);
  2888.         %omega_cur = omega_cur(find(omega_cur'<=60));
  2889.         omega_total = [omega_total omega_cur'];
  2890.         time_locs = locs;
  2891.         time_locs = time_locs(2:end);
  2892.         %time_locs = time_locs(find(omega_cur'<=60));
  2893.         time_total = [time_total time_locs'];
  2894.         %plot(omega_cur, pks(2:end), 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  2895.         %hold on;
  2896.     end
  2897.    
  2898.     if ~isempty([pks, locs]) && size(pks, 1) > 1
  2899.         plot(time_locs, omega_cur,  '.-');
  2900.         hold on;
  2901.     end
  2902. end
  2903.  
  2904. set(gca, 'FontSize', 20);
  2905. %grid on;
  2906. rectangle('Position',[33 0 1 60], 'FaceColor', [0.0 1.0 0.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  2907. hold on;
  2908. rectangle('Position',[37 0 1 60], 'FaceColor', [0.0 1.0 1.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  2909. hold on;
  2910. xlim([24 50]);
  2911. ylim([0 50]);
  2912. ax = gca;
  2913. ax.XTick = [0:2:60];
  2914. ax.YTick = [0:10:50];
  2915. %legend('<\nu_i>');
  2916. %xlabel('Time, sec', 'FontSize', 20);
  2917. ylabel('\nu, s^{-1}', 'FontSize', 20);
  2918. title('b)', 'FontSize', 20);
  2919. box on;
  2920. %time_V = time_V';
  2921.  
  2922. subplot(4, 2, [5 6]);
  2923. if (size(time_V, 2) > size(time_V, 1))
  2924.     time_V = time_V';
  2925. end
  2926. plot(time_k_syn, k_syn_m08, 'LineWidth', 2);
  2927. hold on;
  2928. rectangle('Position',[33 0 1 1.0], 'FaceColor', [0.0 1.0 0.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  2929. hold on;
  2930. rectangle('Position',[37 0 1 1.0], 'FaceColor', [0.0 1.0 1.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  2931. hold on;
  2932. %grid on;
  2933. xlim([24 50]);
  2934. ylim([0 1.0]);
  2935. ax = gca;
  2936. ax.XTick = [0:2:60];
  2937. ax = gca;
  2938. ytickformat('%.1f');
  2939. set(gca, 'YTick', [0.0 : 0.2 : 1.0]);
  2940. %ax.YTick = [0:0.25:1.0];
  2941. xlabel('Time, s', 'FontSize', 20);
  2942. ylabel('k', 'FontSize', 20);
  2943. title('c)', 'FontSize', 20);
  2944. box on;
  2945. set(gca, 'FontSize', 20);
  2946.  
  2947. % subplot(4, 2, 7);
  2948. % plot(time_V, V_m08(:, :), 'LineWidth', 1);
  2949. % hold on;
  2950. % rectangle('Position',[33 -80 1 120], 'EdgeColor', '[0.0 1.0 0.0 0.5]', 'LineWidth', 3);
  2951. % hold on;
  2952. % box on;
  2953. % %grid on;
  2954. % xlim([33 34]);
  2955. % ylim([-80 40]);
  2956. % ax = gca;
  2957. % xtickformat('%.1f');
  2958. % set(gca, 'XTick', [33:0.2:34]);
  2959. % ax.YTick = [-80:40:40];
  2960. % %xlabel('Time, sec', 'FontSize', 12);
  2961. % ylabel('V, mV', 'FontSize', 18);
  2962. % title('d)', 'FontSize', 18);
  2963. % set(gca, 'FontSize', 18);
  2964.  
  2965. subplot(4, 2, 7);
  2966. if (size(time_V, 2) > size(time_V, 1))
  2967.     time_V = time_V';
  2968. end
  2969. regular_V_m08_spiking_counter = 0;
  2970. for i = 1:size(V_m08, 2)
  2971.     %V_p = V(:, 1);
  2972.     V_p = V_m08(:, i);
  2973.     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  2974.     if ~isempty([pks, locs])
  2975.         regular_V_m08_spiking_counter = regular_V_m08_spiking_counter + 1;
  2976.     end
  2977.     for pks_counter = 1:size(pks, 1)
  2978.         pks(pks_counter) = i;
  2979.     end
  2980.     plot(locs, pks, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  2981.     hold on;
  2982.      
  2983.     %N_time_V_array(i, ismember(round(time_V*1e5), round(locs*1e5))) = 1;
  2984. end
  2985.  
  2986. xlim([33 34]);
  2987. ylim([0 size(V_m08, 2)+1]);
  2988. rectangle('Position',[33, 0, 1, 201], 'EdgeColor', '[0.0 1.0 0.0 0.5]', 'LineWidth', 3);
  2989. hold on;
  2990. box on;
  2991. ax = gca;
  2992. ax = gca;
  2993. xtickformat('%.1f');
  2994. set(gca, 'XTick', [33:0.2:34]);
  2995. %ax.YTick = [0:sqrt(size(V, 2)):size(V, 2)];
  2996. ax.YTick = [0:100:size(V_m08, 2)];
  2997. xlabel('Time, s', 'FontSize', 20);
  2998. ylabel('Neuron #', 'FontSize', 20);
  2999. title(['d)'], 'FontSize', 20);
  3000. set(gca, 'FontSize', 20);
  3001.  
  3002. % subplot(4, 2, 8);
  3003. % plot(time_V, V_m08(:, :), 'LineWidth', 1);
  3004. % set(gca, 'FontSize', 18);
  3005. % %grid on;
  3006. % xlim([37 38]);
  3007. % ylim([-80 40]);
  3008. % ax = gca;
  3009. % ax = gca;
  3010. % xtickformat('%.1f');
  3011. % set(gca, 'XTick', [37:0.2:38]);
  3012. % ax.YTick = [-80:40:40];
  3013. % rectangle('Position',[37, -80, 1, 120], 'EdgeColor', '[0.0 1.0 1.0 0.5]', 'LineWidth', 3);
  3014. % hold on;
  3015. % box on;
  3016. % %xlabel('Time, sec', 'FontSize', 12);
  3017. % ylabel('V, mV', 'FontSize', 18);
  3018. % title('e)', 'FontSize', 18);
  3019. % set(gca, 'FontSize', 18);
  3020.  
  3021. subplot(4, 2, 8);
  3022. regular_V_m08_spiking_counter = 0;
  3023. for i = 1:size(V_m08, 2)
  3024.     %V_p = V(:, 1);
  3025.     V_p = V_m08(:, i);
  3026.     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  3027.     if ~isempty([pks, locs])
  3028.         regular_V_m08_spiking_counter = regular_V_m08_spiking_counter + 1;
  3029.     end
  3030.     for pks_counter = 1:size(pks, 1)
  3031.         pks(pks_counter) = i;
  3032.     end
  3033.     plot(locs, pks, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  3034.     hold on;
  3035.      
  3036.     %N_time_V_array(i, ismember(round(time_V*1e5), round(locs*1e5))) = 1;
  3037. end
  3038.  
  3039. xlim([37 38]);
  3040. ylim([0 size(V_m08, 2)+1]);
  3041. rectangle('Position',[37, 0, 1, 201], 'EdgeColor', '[0.0 1.0 1.0 0.5]', 'LineWidth', 3);
  3042. hold on;
  3043. box on;
  3044. ax = gca;
  3045. xtickformat('%.1f');
  3046. set(gca, 'XTick', [37:0.2:38]);
  3047. %ax.YTick = [0:sqrt(size(V, 2)):size(V, 2)];
  3048. ax.YTick = [0:100:size(V_m08, 2)];
  3049. xlabel('Time, s', 'FontSize', 20);
  3050. %ylabel('Neuron #', 'FontSize', 20);
  3051. title(['e)'], 'FontSize', 20);
  3052. set(gca, 'FontSize', 20);
  3053.  
  3054. saveas(gcf, 'results_paper_raster_Ca_V_all_A_m08.png');
  3055. saveas(gcf, 'results_paper_raster_Ca_V_all_A_m08', 'epsc');
  3056. %savefig(results_paper_raster_Ca_V_all,  'results_paper_raster_Ca_V_all.fig')
  3057. close(results_paper_raster_Ca_V_all_A_m08);
  3058. %clear;
  3059. disp('results_paper_raster_Ca_V_all_A_m08 save');
  3060.  
  3061. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3062. %10
  3063. results_paper_raster_Ca_V_all_A_10 = figure('units', 'normalized', 'outerposition', [0 0 0.53 1], 'visible', 'on');
  3064. subplot(4, 2, [1 2]);
  3065. line([0, 60], [0.3, 0.3], 'Color', 'red', 'LineStyle', '--', 'LineWidth', 1);
  3066. hold on;
  3067. plot(time_Ca, Ca_10(:, :), 'LineWidth', 1);
  3068. hold on;
  3069. rectangle('Position',[33 0 1 0.7], 'FaceColor', [0.0 1.0 0.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  3070. hold on;
  3071. rectangle('Position',[37 0 1 0.7], 'FaceColor', [1.0 0.0 1.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  3072. hold on;
  3073. %grid on;
  3074. xlim([24 50]);
  3075. ylim([0 0.7]);
  3076. ax = gca;
  3077. ax.XTick = [0:2:60];
  3078. ax = gca;
  3079. ytickformat('%.1f');
  3080. set(gca, 'YTick', [0.0 : 0.2 : 0.7]);
  3081. %xlabel('Time, sec', 'FontSize', 20);
  3082. ylabel('[Ca^{2+}], \muM', 'FontSize', 20);
  3083. title('a)', 'FontSize', 20);
  3084. box on;
  3085. set(gca, 'FontSize', 20);
  3086.  
  3087. subplot(4, 2, [3 4]);
  3088. if (size(time_V, 2) > size(time_V, 1))
  3089.     time_V = time_V';
  3090. end
  3091. omega_cur = 0;
  3092. omega_total = [];
  3093. time_total = [];
  3094. %yyaxis left;
  3095. regular_V_10_spiking_counter = 0;
  3096. for i = 1:size(V_10, 2)
  3097. %i = 24;
  3098.     V_p = V_10(:, i);
  3099.     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  3100.    
  3101.     for pks_counter = 1:size(pks, 1)
  3102.         pks(pks_counter) = i;
  3103.     end
  3104.  
  3105.     if isempty([pks, locs]) || size(pks, 1) == 1
  3106.         omega_cur = 0;
  3107.         omega_total = [omega_total omega_cur'];
  3108.         time_locs = locs;
  3109.         time_locs = time_locs(2:end);
  3110.         %time_locs = time_locs(find(omega_cur'<=60));
  3111.         time_total = [time_total time_locs'];
  3112.         %plot(omega_cur, i, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  3113.         %hold on;
  3114.     end
  3115.     if ~isempty([pks, locs]) && size(pks, 1) > 1
  3116.         regular_V_10_spiking_counter = regular_V_10_spiking_counter + 1;
  3117.         omega_cur = 1./diff(locs);
  3118.         %omega_cur = omega_cur(find(omega_cur'<=60));
  3119.         omega_total = [omega_total omega_cur'];
  3120.         time_locs = locs;
  3121.         time_locs = time_locs(2:end);
  3122.         %time_locs = time_locs(find(omega_cur'<=60));
  3123.         time_total = [time_total time_locs'];
  3124.         %plot(omega_cur, pks(2:end), 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  3125.         %hold on;
  3126.     end
  3127.    
  3128.     if ~isempty([pks, locs]) && size(pks, 1) > 1
  3129.         plot(time_locs, omega_cur,  '.-');
  3130.         hold on;
  3131.     end
  3132. end
  3133.  
  3134. set(gca, 'FontSize', 20);
  3135. %grid on;
  3136. rectangle('Position',[33 0 1 60], 'FaceColor', [0.0 1.0 0.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  3137. hold on;
  3138. rectangle('Position',[37 0 1 60], 'FaceColor', [1.0 0.0 1.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  3139. hold on;
  3140. xlim([24 50]);
  3141. ylim([0 50]);
  3142. ax = gca;
  3143. ax.XTick = [0:2:60];
  3144. ax.YTick = [0:10:50];
  3145. %legend('<\nu_i>');
  3146. %xlabel('Time, sec', 'FontSize', 20);
  3147. ylabel('\nu, s^{-1}', 'FontSize', 20);
  3148. title('b)', 'FontSize', 20);
  3149. box on;
  3150. %time_V = time_V';
  3151.  
  3152. subplot(4, 2, [5 6]);
  3153. if (size(time_V, 2) > size(time_V, 1))
  3154.     time_V = time_V';
  3155. end
  3156. plot(time_k_syn, k_syn_10, 'LineWidth', 2);
  3157. hold on;
  3158. rectangle('Position',[33 0 1 1.0], 'FaceColor', [0.0 1.0 0.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  3159. hold on;
  3160. rectangle('Position',[37 0 1 1.0], 'FaceColor', [1.0 0.0 1.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  3161. hold on;
  3162. %grid on;
  3163. xlim([24 50]);
  3164. ylim([0 1.0]);
  3165. ax = gca;
  3166. ax.XTick = [0:2:60];
  3167. ax = gca;
  3168. ytickformat('%.1f');
  3169. set(gca, 'YTick', [0.0 : 0.2 : 1.0]);
  3170. %ax.YTick = [0:0.25:1.0];
  3171. xlabel('Time, s', 'FontSize', 20);
  3172. ylabel('k', 'FontSize', 20);
  3173. title('c)', 'FontSize', 20);
  3174. box on;
  3175. set(gca, 'FontSize', 20);
  3176.  
  3177. % subplot(4, 2, 7);
  3178. % plot(time_V, V_m08(:, :), 'LineWidth', 1);
  3179. % hold on;
  3180. % rectangle('Position',[33 -80 1 120], 'EdgeColor', '[0.0 1.0 0.0 0.5]', 'LineWidth', 3);
  3181. % hold on;
  3182. % box on;
  3183. % %grid on;
  3184. % xlim([33 34]);
  3185. % ylim([-80 40]);
  3186. % ax = gca;
  3187. % xtickformat('%.1f');
  3188. % set(gca, 'XTick', [33:0.2:34]);
  3189. % ax.YTick = [-80:40:40];
  3190. % %xlabel('Time, sec', 'FontSize', 12);
  3191. % ylabel('V, mV', 'FontSize', 18);
  3192. % title('d)', 'FontSize', 18);
  3193. % set(gca, 'FontSize', 18);
  3194.  
  3195. subplot(4, 2, 7);
  3196. if (size(time_V, 2) > size(time_V, 1))
  3197.     time_V = time_V';
  3198. end
  3199. regular_V_10_spiking_counter = 0;
  3200. for i = 1:size(V_10, 2)
  3201.     %V_p = V(:, 1);
  3202.     V_p = V_10(:, i);
  3203.     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  3204.     if ~isempty([pks, locs])
  3205.         regular_V_10_spiking_counter = regular_V_10_spiking_counter + 1;
  3206.     end
  3207.     for pks_counter = 1:size(pks, 1)
  3208.         pks(pks_counter) = i;
  3209.     end
  3210.     plot(locs, pks, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  3211.     hold on;
  3212.      
  3213.     %N_time_V_array(i, ismember(round(time_V*1e5), round(locs*1e5))) = 1;
  3214. end
  3215.  
  3216. xlim([33 34]);
  3217. ylim([0 size(V_10, 2)+1]);
  3218. rectangle('Position',[33, 0, 1, 201], 'EdgeColor', '[0.0 1.0 0.0 0.5]', 'LineWidth', 3);
  3219. hold on;
  3220. box on;
  3221. ax = gca;
  3222. ax = gca;
  3223. xtickformat('%.1f');
  3224. set(gca, 'XTick', [33:0.2:34]);
  3225. %ax.YTick = [0:sqrt(size(V, 2)):size(V, 2)];
  3226. ax.YTick = [0:100:size(V_10, 2)];
  3227. xlabel('Time, s', 'FontSize', 20);
  3228. ylabel('Neuron #', 'FontSize', 20);
  3229. title(['d)'], 'FontSize', 20);
  3230. set(gca, 'FontSize', 20);
  3231.  
  3232. % subplot(4, 2, 8);
  3233. % plot(time_V, V_m08(:, :), 'LineWidth', 1);
  3234. % set(gca, 'FontSize', 18);
  3235. % %grid on;
  3236. % xlim([37 38]);
  3237. % ylim([-80 40]);
  3238. % ax = gca;
  3239. % ax = gca;
  3240. % xtickformat('%.1f');
  3241. % set(gca, 'XTick', [37:0.2:38]);
  3242. % ax.YTick = [-80:40:40];
  3243. % rectangle('Position',[37, -80, 1, 120], 'EdgeColor', '[0.0 1.0 1.0 0.5]', 'LineWidth', 3);
  3244. % hold on;
  3245. % box on;
  3246. % %xlabel('Time, sec', 'FontSize', 12);
  3247. % ylabel('V, mV', 'FontSize', 18);
  3248. % title('e)', 'FontSize', 18);
  3249. % set(gca, 'FontSize', 18);
  3250.  
  3251. subplot(4, 2, 8);
  3252. regular_V_10_spiking_counter = 0;
  3253. for i = 1:size(V_10, 2)
  3254.     %V_p = V(:, 1);
  3255.     V_p = V_10(:, i);
  3256.     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  3257.     if ~isempty([pks, locs])
  3258.         regular_V_10_spiking_counter = regular_V_10_spiking_counter + 1;
  3259.     end
  3260.     for pks_counter = 1:size(pks, 1)
  3261.         pks(pks_counter) = i;
  3262.     end
  3263.     plot(locs, pks, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  3264.     hold on;
  3265.      
  3266.     %N_time_V_array(i, ismember(round(time_V*1e5), round(locs*1e5))) = 1;
  3267. end
  3268.  
  3269. xlim([37 38]);
  3270. ylim([0 size(V_10, 2)+1]);
  3271. rectangle('Position',[37, 0, 1, 201], 'EdgeColor', '[1.0 0.0 1.0 0.5]', 'LineWidth', 3);
  3272. hold on;
  3273. box on;
  3274. ax = gca;
  3275. xtickformat('%.1f');
  3276. set(gca, 'XTick', [37:0.2:38]);
  3277. %ax.YTick = [0:sqrt(size(V, 2)):size(V, 2)];
  3278. ax.YTick = [0:100:size(V_10, 2)];
  3279. xlabel('Time, s', 'FontSize', 20);
  3280. %ylabel('Neuron #', 'FontSize', 20);
  3281. title(['e)'], 'FontSize', 20);
  3282. set(gca, 'FontSize', 20);
  3283.  
  3284. saveas(gcf, 'results_paper_raster_Ca_V_all_A_10.png');
  3285. saveas(gcf, 'results_paper_raster_Ca_V_all_A_10', 'epsc');
  3286. %savefig(results_paper_raster_Ca_V_all,  'results_paper_raster_Ca_V_all.fig')
  3287. close(results_paper_raster_Ca_V_all_A_10);
  3288. %clear;
  3289. disp('results_paper_raster_Ca_V_all_A_10 save');
  3290.  
  3291. return
  3292. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3293. results_paper_raster_V_g_astro_A = figure('units', 'normalized', 'outerposition', [0 0 0.55 1], 'visible', 'on');
  3294. subplot(4, 3, [1 2 3]);
  3295. line([0, 60], [0.3, 0.3], 'Color', 'red', 'LineStyle', '--', 'LineWidth', 1);
  3296. hold on;
  3297. plot(time_Ca, Ca_m08(:, :), 'LineWidth', 1);
  3298. hold on;
  3299. rectangle('Position',[33 0 1 0.7], 'FaceColor', [0.0 1.0 0.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  3300. hold on;
  3301. rectangle('Position',[37 0 1 0.7], 'FaceColor', [0.0 1.0 1.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  3302. hold on;
  3303. rectangle('Position',[46 0 1 0.7], 'FaceColor', [1.0 0.0 1.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  3304. hold on;
  3305. %grid on;
  3306. xlim([24 50]);
  3307. ylim([0 0.7]);
  3308. ax = gca;
  3309. ax.XTick = [0:2:60];
  3310. ax = gca;
  3311. ytickformat('%.1f');
  3312. set(gca, 'YTick', [0.0 : 0.2 : 0.7]);
  3313. %xlabel('Time, sec', 'FontSize', 14);
  3314. ylabel('[Ca^{2+}], \muM', 'FontSize', 18);
  3315. title('a)', 'FontSize', 18);
  3316. box on;
  3317. set(gca, 'FontSize', 18);
  3318.  
  3319. subplot(4, 3, 4);
  3320. if (size(time_V, 2) > size(time_V, 1))
  3321.     time_V = time_V';
  3322. end
  3323. %time_V = time_V';
  3324. omega_cur = 0;
  3325. omega_total = [];
  3326. time_total = [];
  3327. %yyaxis left;
  3328. regular_V_m08_spiking_counter = 0;
  3329. for i = 1:size(V_m08, 2)
  3330. %i = 24;
  3331.     V_p = V_m08(:, i);
  3332.     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  3333.    
  3334.     for pks_counter = 1:size(pks, 1)
  3335.         pks(pks_counter) = i;
  3336.     end
  3337.  
  3338.     if isempty([pks, locs]) || size(pks, 1) == 1
  3339.         omega_cur = 0;
  3340.         omega_total = [omega_total omega_cur'];
  3341.         time_locs = locs;
  3342.         time_locs = time_locs(2:end);
  3343.         %time_locs = time_locs(find(omega_cur'<=60));
  3344.         time_total = [time_total time_locs'];
  3345.         %plot(omega_cur, i, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  3346.         %hold on;
  3347.     end
  3348.     if ~isempty([pks, locs]) && size(pks, 1) > 1
  3349.         regular_V_m08_spiking_counter = regular_V_m08_spiking_counter + 1;
  3350.         omega_cur = 1./diff(locs);
  3351.         %omega_cur = omega_cur(find(omega_cur'<=60));
  3352.         omega_total = [omega_total omega_cur'];
  3353.         time_locs = locs;
  3354.         time_locs = time_locs(2:end);
  3355.         %time_locs = time_locs(find(omega_cur'<=60));
  3356.         time_total = [time_total time_locs'];
  3357.         %plot(omega_cur, pks(2:end), 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  3358.         %hold on;
  3359.     end
  3360.    
  3361.     if ~isempty([pks, locs]) && size(pks, 1) > 1
  3362.         plot(time_locs, omega_cur,  '.-');
  3363.         hold on;
  3364.     end
  3365. end
  3366.  
  3367. set(gca, 'FontSize', 18);
  3368. %grid on;
  3369. rectangle('Position',[33 0 1 60], 'FaceColor', [0.0 1.0 0.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  3370. hold on;
  3371. % rectangle('Position',[37 0 1 60], 'FaceColor', [0.0 1.0 1.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  3372. % hold on;
  3373. xlim([30 35]);
  3374. ylim([0 50]);
  3375. ax = gca;
  3376. ax.XTick = [0:1:60];
  3377. ax.YTick = [0:10:50];
  3378. %legend('<\nu_i>');
  3379. %xlabel('Time, sec', 'FontSize', 12);
  3380. ylabel('\nu, s^{-1}', 'FontSize', 18);
  3381. title('b)', 'FontSize', 18);
  3382. box on;
  3383. %time_V = time_V';
  3384.  
  3385. subplot(4, 3, 5);
  3386. if (size(time_V, 2) > size(time_V, 1))
  3387.     time_V = time_V';
  3388. end
  3389. %time_V = time_V';
  3390. omega_cur = 0;
  3391. omega_total = [];
  3392. time_total = [];
  3393. %yyaxis left;
  3394. regular_V_m08_spiking_counter = 0;
  3395. for i = 1:size(V_m08, 2)
  3396. %i = 24;
  3397.     V_p = V_m08(:, i);
  3398.     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  3399.    
  3400.     for pks_counter = 1:size(pks, 1)
  3401.         pks(pks_counter) = i;
  3402.     end
  3403.  
  3404.     if isempty([pks, locs]) || size(pks, 1) == 1
  3405.         omega_cur = 0;
  3406.         omega_total = [omega_total omega_cur'];
  3407.         time_locs = locs;
  3408.         time_locs = time_locs(2:end);
  3409.         %time_locs = time_locs(find(omega_cur'<=60));
  3410.         time_total = [time_total time_locs'];
  3411.         %plot(omega_cur, i, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  3412.         %hold on;
  3413.     end
  3414.     if ~isempty([pks, locs]) && size(pks, 1) > 1
  3415.         regular_V_m08_spiking_counter = regular_V_m08_spiking_counter + 1;
  3416.         omega_cur = 1./diff(locs);
  3417.         %omega_cur = omega_cur(find(omega_cur'<=60));
  3418.         omega_total = [omega_total omega_cur'];
  3419.         time_locs = locs;
  3420.         time_locs = time_locs(2:end);
  3421.         %time_locs = time_locs(find(omega_cur'<=60));
  3422.         time_total = [time_total time_locs'];
  3423.         %plot(omega_cur, pks(2:end), 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  3424.         %hold on;
  3425.     end
  3426.    
  3427.     if ~isempty([pks, locs]) && size(pks, 1) > 1
  3428.         plot(time_locs, omega_cur,  '.-');
  3429.         hold on;
  3430.     end
  3431. end
  3432.  
  3433. set(gca, 'FontSize', 18);
  3434. %grid on;
  3435. % rectangle('Position',[33 0 1 60], 'FaceColor', [0.0 1.0 0.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  3436. % hold on;
  3437. rectangle('Position',[37 0 1 60], 'FaceColor', [0.0 1.0 1.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  3438. hold on;
  3439. xlim([35 40]);
  3440. ylim([0 50]);
  3441. ax = gca;
  3442. ax.XTick = [0:1:60];
  3443. ax.YTick = [0:10:50];
  3444. %legend('<\nu_i>');
  3445. %xlabel('Time, sec', 'FontSize', 12);
  3446. %ylabel('\nu, s^{-1}', 'FontSize', 18);
  3447. title('c)', 'FontSize', 18);
  3448. box on;
  3449. %time_V = time_V';
  3450.  
  3451. subplot(4, 3, 6);
  3452. if (size(time_V, 2) > size(time_V, 1))
  3453.     time_V = time_V';
  3454. end
  3455. %time_V = time_V';
  3456. omega_cur = 0;
  3457. omega_total = [];
  3458. time_total = [];
  3459. %yyaxis left;
  3460. regular_V_m08_spiking_counter = 0;
  3461. for i = 1:size(V_10, 2)
  3462. %i = 24;
  3463.     V_p = V_10(:, i);
  3464.     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  3465.    
  3466.     for pks_counter = 1:size(pks, 1)
  3467.         pks(pks_counter) = i;
  3468.     end
  3469.  
  3470.     if isempty([pks, locs]) || size(pks, 1) == 1
  3471.         omega_cur = 0;
  3472.         omega_total = [omega_total omega_cur'];
  3473.         time_locs = locs;
  3474.         time_locs = time_locs(2:end);
  3475.         %time_locs = time_locs(find(omega_cur'<=60));
  3476.         time_total = [time_total time_locs'];
  3477.         %plot(omega_cur, i, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  3478.         %hold on;
  3479.     end
  3480.     if ~isempty([pks, locs]) && size(pks, 1) > 1
  3481.         regular_V_m08_spiking_counter = regular_V_m08_spiking_counter + 1;
  3482.         omega_cur = 1./diff(locs);
  3483.         %omega_cur = omega_cur(find(omega_cur'<=60));
  3484.         omega_total = [omega_total omega_cur'];
  3485.         time_locs = locs;
  3486.         time_locs = time_locs(2:end);
  3487.         %time_locs = time_locs(find(omega_cur'<=60));
  3488.         time_total = [time_total time_locs'];
  3489.         %plot(omega_cur, pks(2:end), 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  3490.         %hold on;
  3491.     end
  3492.    
  3493.     if ~isempty([pks, locs]) && size(pks, 1) > 1
  3494.         plot(time_locs, omega_cur,  '.-');
  3495.         hold on;
  3496.     end
  3497. end
  3498.  
  3499. set(gca, 'FontSize', 18);
  3500. %grid on;
  3501. % rectangle('Position',[33 0 1 60], 'FaceColor', [0.0 1.0 0.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  3502. % hold on;
  3503. rectangle('Position',[46 0 1 60], 'FaceColor', [1.0 0.0 1.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  3504. hold on;
  3505. xlim([44 49]);
  3506. ylim([0 50]);
  3507. ax = gca;
  3508. ax.XTick = [0:1:60];
  3509. ax.YTick = [0:10:50];
  3510. %legend('<\nu_i>');
  3511. %xlabel('Time, sec', 'FontSize', 12);
  3512. %ylabel('\nu, s^{-1}', 'FontSize', 18);
  3513. title('d)', 'FontSize', 18);
  3514. box on;
  3515. %time_V = time_V';
  3516.  
  3517. subplot(4, 3, 7);
  3518. plot(time_k_syn, k_syn_m08, 'LineWidth', 2);
  3519. hold on;
  3520. rectangle('Position',[33 0 1 1.0], 'FaceColor', [0.0 1.0 0.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  3521. hold on;
  3522. %grid on;
  3523. xlim([30 35]);
  3524. ylim([0 1.0]);
  3525. ax = gca;
  3526. ax.XTick = [0:1:60];
  3527. ax = gca;
  3528. ytickformat('%.1f');
  3529. set(gca, 'YTick', [0.0 : 0.2 : 1.0]);
  3530. %ax.YTick = [0:0.25:1.0];
  3531. %xlabel('Time, s', 'FontSize', 18);
  3532. ylabel('k', 'FontSize', 18);
  3533. title('e)', 'FontSize', 18);
  3534. box on;
  3535. set(gca, 'FontSize', 18);
  3536.  
  3537. subplot(4, 3, 8);
  3538. plot(time_k_syn, k_syn_m08, 'LineWidth', 2);
  3539. hold on;
  3540. rectangle('Position',[37 0 1 1.0], 'FaceColor', [0.0 1.0 1.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  3541. hold on;
  3542. %grid on;
  3543. xlim([35 40]);
  3544. ylim([0 1.0]);
  3545. ax = gca;
  3546. ax.XTick = [0:1:60];
  3547. ax = gca;
  3548. ytickformat('%.1f');
  3549. set(gca, 'YTick', [0.0 : 0.2 : 1.0]);
  3550. %ax.YTick = [0:0.25:1.0];
  3551. %xlabel('Time, s', 'FontSize', 18);
  3552. %ylabel('k', 'FontSize', 18);
  3553. title('f)', 'FontSize', 18);
  3554. box on;
  3555. set(gca, 'FontSize', 18);
  3556.  
  3557. subplot(4, 3, 9);
  3558. plot(time_k_syn, k_syn_10, 'LineWidth', 2);
  3559. hold on;
  3560. rectangle('Position',[46 0 1 1.0], 'FaceColor', [1.0 0.0 1.0 0.2], 'EdgeColor', 'none', 'LineStyle', 'none');
  3561. hold on;
  3562. %grid on;
  3563. xlim([44 49]);
  3564. ylim([0 1.0]);
  3565. ax = gca;
  3566. ax.XTick = [0:1:60];
  3567. ax = gca;
  3568. ytickformat('%.1f');
  3569. set(gca, 'YTick', [0.0 : 0.2 : 1.0]);
  3570. %ax.YTick = [0:0.25:1.0];
  3571. %xlabel('Time, s', 'FontSize', 18);
  3572. %ylabel('k', 'FontSize', 18);
  3573. title('g)', 'FontSize', 18);
  3574. box on;
  3575. set(gca, 'FontSize', 18);
  3576.  
  3577. subplot(4, 3, 10);
  3578. if (size(time_V, 2) > size(time_V, 1))
  3579.     time_V = time_V';
  3580. end
  3581. regular_V_m08_spiking_counter = 0;
  3582. for i = 1:size(V_m08, 2)
  3583.     %V_p = V(:, 1);
  3584.     V_p = V_m08(:, i);
  3585.     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  3586.     if ~isempty([pks, locs])
  3587.         regular_V_m08_spiking_counter = regular_V_m08_spiking_counter + 1;
  3588.     end
  3589.     for pks_counter = 1:size(pks, 1)
  3590.         pks(pks_counter) = i;
  3591.     end
  3592.     plot(locs, pks, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  3593.     hold on;
  3594.      
  3595.     %N_time_V_array(i, ismember(round(time_V*1e5), round(locs*1e5))) = 1;
  3596. end
  3597.  
  3598. xlim([33 34]);
  3599. ylim([0 size(V_m08, 2)+1]);
  3600. rectangle('Position',[33, 0, 1, 201], 'EdgeColor', '[0.0 1.0 0.0 0.5]', 'LineWidth', 3);
  3601. hold on;
  3602. box on;
  3603. ax = gca;
  3604. ax = gca;
  3605. xtickformat('%.1f');
  3606. set(gca, 'XTick', [33:0.5:34]);
  3607. %ax.YTick = [0:sqrt(size(V, 2)):size(V, 2)];
  3608. ax.YTick = [0:100:size(V_m08, 2)];
  3609. xlabel('Time, s', 'FontSize', 18);
  3610. ylabel('Neuron #', 'FontSize', 18);
  3611. title(['h)'], 'FontSize', 18);
  3612. set(gca, 'FontSize', 18);
  3613.  
  3614. subplot(4, 3, 11);
  3615. if (size(time_V, 2) > size(time_V, 1))
  3616.     time_V = time_V';
  3617. end
  3618. regular_V_m08_spiking_counter = 0;
  3619. for i = 1:size(V_m08, 2)
  3620.     %V_p = V(:, 1);
  3621.     V_p = V_m08(:, i);
  3622.     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  3623.     if ~isempty([pks, locs])
  3624.         regular_V_m08_spiking_counter = regular_V_m08_spiking_counter + 1;
  3625.     end
  3626.     for pks_counter = 1:size(pks, 1)
  3627.         pks(pks_counter) = i;
  3628.     end
  3629.     plot(locs, pks, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  3630.     hold on;
  3631.      
  3632.     %N_time_V_array(i, ismember(round(time_V*1e5), round(locs*1e5))) = 1;
  3633. end
  3634.  
  3635. xlim([37 38]);
  3636. ylim([0 size(V_m08, 2)+1]);
  3637. rectangle('Position',[37, 0, 1, 201], 'EdgeColor', '[0.0 1.0 1.0 0.5]', 'LineWidth', 3);
  3638. hold on;
  3639. box on;
  3640. ax = gca;
  3641. ax = gca;
  3642. xtickformat('%.1f');
  3643. set(gca, 'XTick', [37:0.5:38]);
  3644. %ax.YTick = [0:sqrt(size(V, 2)):size(V, 2)];
  3645. ax.YTick = [0:100:size(V_m08, 2)];
  3646. xlabel('Time, s', 'FontSize', 18);
  3647. %ylabel('Neuron #', 'FontSize', 18);
  3648. title(['i)'], 'FontSize', 18);
  3649. set(gca, 'FontSize', 18);
  3650.  
  3651. subplot(4, 3, 12);
  3652. if (size(time_V, 2) > size(time_V, 1))
  3653.     time_V = time_V';
  3654. end
  3655. regular_V_m08_spiking_counter = 0;
  3656. for i = 1:size(V_10, 2)
  3657.     %V_p = V(:, 1);
  3658.     V_p = V_10(:, i);
  3659.     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  3660.     if ~isempty([pks, locs])
  3661.         regular_V_m08_spiking_counter = regular_V_m08_spiking_counter + 1;
  3662.     end
  3663.     for pks_counter = 1:size(pks, 1)
  3664.         pks(pks_counter) = i;
  3665.     end
  3666.     plot(locs, pks, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  3667.     hold on;
  3668.      
  3669.     %N_time_V_array(i, ismember(round(time_V*1e5), round(locs*1e5))) = 1;
  3670. end
  3671.  
  3672. xlim([46 47]);
  3673. ylim([0 size(V_10, 2)+1]);
  3674. rectangle('Position',[46, 0, 1, 201], 'EdgeColor', '[1.0 0.0 1.0 0.5]', 'LineWidth', 3);
  3675. hold on;
  3676. box on;
  3677. ax = gca;
  3678. ax = gca;
  3679. xtickformat('%.1f');
  3680. set(gca, 'XTick', [46:0.5:47]);
  3681. %ax.YTick = [0:sqrt(size(V, 2)):size(V, 2)];
  3682. ax.YTick = [0:100:size(V_10, 2)];
  3683. xlabel('Time, s', 'FontSize', 18);
  3684. %ylabel('Neuron #', 'FontSize', 18);
  3685. title(['j)'], 'FontSize', 18);
  3686. set(gca, 'FontSize', 18);
  3687.  
  3688. saveas(gcf, 'results_paper_raster_V_g_astro_A.png');
  3689. saveas(gcf, 'results_paper_raster_V_g_astro_A', 'epsc');
  3690. %savefig(results_paper_raster_Ca_V_all,  'results_paper_raster_Ca_V_all.fig')
  3691. close(results_paper_raster_V_g_astro_A);
  3692. %clear;
  3693. disp('results_paper_raster_V_g_astro_A save');
  3694.  
  3695. return
  3696.  
  3697. % subplot(5, 2, 7);
  3698. % plot(time_V, V(:, :), 'LineWidth', 1);
  3699. % hold on;
  3700. % rectangle('Position',[33 -80 1 120], 'EdgeColor', '[0.0 1.0 0.0 0.5]', 'LineWidth', 3);
  3701. % hold on;
  3702. % box on;
  3703. % %grid on;
  3704. % xlim([33 34]);
  3705. % ylim([-80 40]);
  3706. % ax = gca;
  3707. % xtickformat('%.1f');
  3708. % set(gca, 'XTick', [33:0.2:34]);
  3709. % ax.YTick = [-80:40:40];
  3710. % %xlabel('Time, sec', 'FontSize', 12);
  3711. % ylabel('V, mV', 'FontSize', 18);
  3712. % title('d)', 'FontSize', 18);
  3713. % set(gca, 'FontSize', 18);
  3714.  
  3715. subplot(4, 2, 7);
  3716. time_V = time_V';
  3717. regular_V_m08_spiking_counter = 0;
  3718. for i = 1:size(V_m08, 2)
  3719.     %V_p = V(:, 1);
  3720.     V_p = V_m08(:, i);
  3721.     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  3722.     if ~isempty([pks, locs])
  3723.         regular_V_m08_spiking_counter = regular_V_m08_spiking_counter + 1;
  3724.     end
  3725.     for pks_counter = 1:size(pks, 1)
  3726.         pks(pks_counter) = i;
  3727.     end
  3728.     plot(locs, pks, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  3729.     hold on;
  3730.      
  3731.     N_time_V_array(i, ismember(round(time_V*1e5), round(locs*1e5))) = 1;
  3732. end
  3733.  
  3734. xlim([33 34]);
  3735. ylim([0 size(V_m08, 2)+1]);
  3736. rectangle('Position',[33, 0, 1, 201], 'EdgeColor', '[0.0 1.0 0.0 0.5]', 'LineWidth', 3);
  3737. hold on;
  3738. box on;
  3739. ax = gca;
  3740. ax = gca;
  3741. xtickformat('%.1f');
  3742. set(gca, 'XTick', [33:0.2:34]);
  3743. %ax.YTick = [0:sqrt(size(V, 2)):size(V, 2)];
  3744. ax.YTick = [0:100:size(V_m08, 2)];
  3745. xlabel('Time, s', 'FontSize', 18);
  3746. ylabel('Neuron #', 'FontSize', 18);
  3747. title(['f)'], 'FontSize', 18);
  3748. set(gca, 'FontSize', 18);
  3749.  
  3750. % subplot(5, 2, 8);
  3751. % plot(time_V, V(:, :), 'LineWidth', 1);
  3752. % set(gca, 'FontSize', 18);
  3753. % %grid on;
  3754. % xlim([37 38]);
  3755. % ylim([-80 40]);
  3756. % ax = gca;
  3757. % ax = gca;
  3758. % xtickformat('%.1f');
  3759. % set(gca, 'XTick', [37:0.2:38]);
  3760. % ax.YTick = [-80:40:40];
  3761. % rectangle('Position',[37, -80, 1, 120], 'EdgeColor', '[0.0 1.0 1.0 0.5]', 'LineWidth', 3);
  3762. % hold on;
  3763. % box on;
  3764. % %xlabel('Time, sec', 'FontSize', 12);
  3765. % ylabel('V, mV', 'FontSize', 18);
  3766. % title('e)', 'FontSize', 18);
  3767. % set(gca, 'FontSize', 18);
  3768.  
  3769. subplot(4, 2, 8);
  3770. regular_V_m08_spiking_counter = 0;
  3771. for i = 1:size(V_m08, 2)
  3772.     %V_p = V(:, 1);
  3773.     V_p = V_m08(:, i);
  3774.     [pks, locs] = findpeaks(V_p, time_V, 'MinPeakHeight', -10, 'MinPeakDistance', 0.001);
  3775.     if ~isempty([pks, locs])
  3776.         regular_V_m08_spiking_counter = regular_V_m08_spiking_counter + 1;
  3777.     end
  3778.     for pks_counter = 1:size(pks, 1)
  3779.         pks(pks_counter) = i;
  3780.     end
  3781.     plot(locs, pks, 'd', 'MarkerSize', 2, 'MarkerFaceColor', 'k', 'MarkerEdgeColor', 'k');
  3782.     hold on;
  3783.      
  3784.     N_time_V_array(i, ismember(round(time_V*1e5), round(locs*1e5))) = 1;
  3785. end
  3786.  
  3787. xlim([37 38]);
  3788. ylim([0 size(V_m08, 2)+1]);
  3789. rectangle('Position',[37, 0, 1, 201], 'EdgeColor', '[0.0 1.0 1.0 0.5]', 'LineWidth', 3);
  3790. hold on;
  3791. box on;
  3792. ax = gca;
  3793. xtickformat('%.1f');
  3794. set(gca, 'XTick', [37:0.2:38]);
  3795. %ax.YTick = [0:sqrt(size(V, 2)):size(V, 2)];
  3796. ax.YTick = [0:100:size(V_m08, 2)];
  3797. xlabel('Time, s', 'FontSize', 18);
  3798. ylabel('Neuron #', 'FontSize', 18);
  3799. title(['g)'], 'FontSize', 18);
  3800. set(gca, 'FontSize', 18);
  3801.  
  3802. saveas(gcf, 'results_paper_raster_Ca_V_all.png');
  3803. saveas(gcf, 'results_paper_raster_Ca_V_all', 'epsc');
  3804. %savefig(results_paper_raster_Ca_V_all,  'results_paper_raster_Ca_V_all.fig')
  3805. close(results_paper_raster_Ca_V_all_m08);
  3806. %clear;
  3807. disp('results_paper_raster_Ca_V_all save');
  3808. %%%%%%%
  3809.  
  3810. clear all;
  3811.  
  3812. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement