Fig2AB_LinePlot.m 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. %% Fig. 2A-B_LinePlot
  2. clear all
  3. close all
  4. % ==========================================================================
  5. %% k-mean cluster lineplot
  6. % ==========================================================================
  7. %Prepare variables
  8. load('Fig2AB_LinePlot.mat');
  9. TimeWinFrame = [-15:1:120];% -0.5 s to 4.0 s
  10. fs = 30;
  11. %Learning phase
  12. initial = 1;
  13. reversal = 2;
  14. %Learning stage
  15. naive = 1;
  16. expert = 2;
  17. for iLearning = 1:2 %1 = Initial, 2 = Reversal
  18. disp(['iLearning = ', num2str(iLearning)]);
  19. switch iLearning
  20. case 1
  21. f1 = figure('Name', 'Go-kmean cluster-Initial');
  22. f1.Position = [190 198 560 420];
  23. Mean = LineMean_Initial;
  24. SEM = LineSEM_Initial;
  25. case 2
  26. f2 = figure('Name', 'Go-kmean cluster-Reversal');
  27. f2.Position = [200 250 560 420];
  28. Mean = LineMean_Reversal;
  29. SEM = LineSEM_Reversal;
  30. end
  31. for iCluster = 1:6 %NofCluter is 6
  32. disp(['iCluster = ', num2str(iCluster)]);
  33. subplot(2, 3, iCluster);
  34. %Naive-----------------------------------------------------------
  35. shadedErrorBar2(TimeWinFrame/fs, Mean(iCluster, :, 1), SEM(iCluster, :, 1), {'-','color', [0 0 1]});
  36. box off
  37. hold on;
  38. %Expert------------------------------------------------------------
  39. shadedErrorBar2(TimeWinFrame/fs, Mean(iCluster, :, 2), SEM(iCluster, :, 2), {'-','color', [1 0 0]});
  40. hline(0, 'k');
  41. % Adjust lims
  42. xlim([-0.5 4.0]);
  43. ylim([-1.0 1.0]);
  44. %title
  45. switch iCluster
  46. case 1
  47. title('Stable1')
  48. case 2
  49. title('Stable2')
  50. case 3
  51. title('Up')
  52. case 4
  53. title('Down')
  54. case 5
  55. title('Ramp-up')
  56. case 6
  57. title('Ramp-down')
  58. end
  59. end %iCluster
  60. end %iLearning