-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFiringVsFrequencyVsAmplitude.m
159 lines (155 loc) · 5.83 KB
/
FiringVsFrequencyVsAmplitude.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
Fs = 1;
tvec=1/(1000*Fs):1/(1000*Fs):0.1;
%Excitatory threshold is -5
%Inhibitory threshold is 15
frequency_axis = zeros(1,51);
excite_frequency_output = zeros(1,51);
inhibit_frequency_output = zeros(1,51);
for index=1:length(excite_frequency_output)
frequency_axis(index) = 5*(index-1);
signal = 5*cos(frequency_axis(index)*2*pi*tvec);
[T,S_excite]=Excitatory_Model(-70,10,0,signal,length(signal),Fs);
excite_counter = 0;
excite_state = 0;
V_excite = S_excite(:,4);
for t=1:length(V_excite)
if ((excite_state == 0) && (V_excite(t) > -5))
excite_state = 1;
end
if ((excite_state == 1) && (V_excite(t) < -5))
excite_state = 0;
excite_counter=excite_counter+1;
end
end
excite_frequency_output(index) = 10*excite_counter;
[T,S_inhibit]=Inhibitory_Model(-70,10,0,signal,length(signal),Fs);
inhibit_counter = 0;
inhibit_state = 0;
V_inhibit = S_inhibit(:,3);
for t=1:length(V_inhibit)
if ((inhibit_state == 0) && (V_inhibit(t) > 15))
inhibit_state = 1;
end
if ((inhibit_state == 1) && (V_inhibit(t) < 15))
inhibit_state = 0;
inhibit_counter=inhibit_counter+1;
end
end
inhibit_frequency_output(index) = 10*inhibit_counter;
end
response = figure;
plot(frequency_axis,excite_frequency_output,'r');xlabel('Frequency (Hz)');ylabel('Firing Rate (Hz)');%title('Firing Frequency vs. Stimulation Frequency (Signal Amplitude 5)');
set(gca,'fontsize',24);
set(gca,'fontname','Times');
ylim([0 400]);
hold on;
plot(frequency_axis,inhibit_frequency_output,'b');
set(findall(gca, 'Type', 'Line'),'LineWidth',2);
xlim([min(frequency_axis) max(frequency_axis)]);
l = legend('Excitatory','Inhibitory');
set(l,'FontSize',24);
set(l,'FontName','Times');
saveas(response,'/Users/manugopa/Dropbox/NeuralResearch/FigsAfterReview/FvF5.fig');
print(response,'/Users/manugopa/Dropbox/NeuralResearch/FigsAfterReview/FvF5.jpg','-djpeg','-r300');
%Excitatory threshold is -5
%Inhibitory threshold is 15
frequency_axis = zeros(1,51);
excite_frequency_output = zeros(1,51);
inhibit_frequency_output = zeros(1,51);
for index=1:length(excite_frequency_output)
frequency_axis(index) = 5*(index-1);
signal = 10*cos(frequency_axis(index)*2*pi*tvec);
[T,S_excite]=Excitatory_Model(-70,10,0,signal,length(signal),Fs);
excite_counter = 0;
excite_state = 0;
V_excite = S_excite(:,4);
for t=1:length(V_excite)
if ((excite_state == 0) && (V_excite(t) > -5))
excite_state = 1;
end
if ((excite_state == 1) && (V_excite(t) < -5))
excite_state = 0;
excite_counter=excite_counter+1;
end
end
excite_frequency_output(index) = 10*excite_counter;
[T,S_inhibit]=Inhibitory_Model(-70,10,0,signal,length(signal),Fs);
inhibit_counter = 0;
inhibit_state = 0;
V_inhibit = S_inhibit(:,3);
for t=1:length(V_inhibit)
if ((inhibit_state == 0) && (V_inhibit(t) > 15))
inhibit_state = 1;
end
if ((inhibit_state == 1) && (V_inhibit(t) < 15))
inhibit_state = 0;
inhibit_counter=inhibit_counter+1;
end
end
inhibit_frequency_output(index) = 10*inhibit_counter;
end
response = figure;
plot(frequency_axis,excite_frequency_output,'r');xlabel('Frequency (Hz)');ylabel('Firing Rate (Hz)');%title('Firing Frequency vs. Stimulation Frequency (Signal Amplitude 10)');
set(gca,'fontsize',24);
set(gca,'fontname','Times');
ylim([0 400]);
hold on;
plot(frequency_axis,inhibit_frequency_output,'b');
set(findall(gca, 'Type', 'Line'),'LineWidth',2);
xlim([min(frequency_axis) max(frequency_axis)]);
l = legend('Excitatory','Inhibitory');
set(l,'FontSize',24);
set(l,'FontName','Times');
saveas(response,'/Users/manugopa/Dropbox/NeuralResearch/FigsAfterReview/FvF10.fig');
print(response,'/Users/manugopa/Dropbox/NeuralResearch/FigsAfterReview/FvF10.jpg','-djpeg','-r300');
%Excitatory threshold is -5
%Inhibitory threshold is 15
frequency_axis = zeros(1,51);
excite_frequency_output = zeros(1,51);
inhibit_frequency_output = zeros(1,51);
for index=1:length(excite_frequency_output)
frequency_axis(index) = 5*(index-1);
signal = 30*cos(frequency_axis(index)*2*pi*tvec);
[T,S_excite]=Excitatory_Model(-70,10,0,signal,length(signal),Fs);
excite_counter = 0;
excite_state = 0;
V_excite = S_excite(:,4);
for t=1:length(V_excite)
if ((excite_state == 0) && (V_excite(t) > -5))
excite_state = 1;
end
if ((excite_state == 1) && (V_excite(t) < -5))
excite_state = 0;
excite_counter=excite_counter+1;
end
end
excite_frequency_output(index) = 10*excite_counter
[T,S_inhibit]=Inhibitory_Model(-70,10,0,signal,length(signal),Fs);
inhibit_counter = 0;
inhibit_state = 0;
V_inhibit = S_inhibit(:,3);
for t=1:length(V_inhibit)
if ((inhibit_state == 0) && (V_inhibit(t) > 15))
inhibit_state = 1;
end
if ((inhibit_state == 1) && (V_inhibit(t) < 15))
inhibit_state = 0;
inhibit_counter=inhibit_counter+1;
end
end
inhibit_frequency_output(index) = 10*inhibit_counter
end
response = figure;
plot(frequency_axis,excite_frequency_output,'r');xlabel('Frequency (Hz)');ylabel('Firing Rate (Hz)');%title('Firing Frequency vs. Stimulation Frequency (Signal Amplitude 30)');
set(gca,'fontsize',24);
set(gca,'fontname','Times');
ylim([0 400]);
hold on;
plot(frequency_axis,inhibit_frequency_output,'b');
set(findall(gca, 'Type', 'Line'),'LineWidth',2);
xlim([min(frequency_axis) max(frequency_axis)]);
l = legend('Excitatory','Inhibitory');
set(l,'FontSize',24);
set(l,'FontName','Times');
saveas(response,'/Users/manugopa/Dropbox/NeuralResearch/FigsAfterReview/FvF30.fig');
print(response,'/Users/manugopa/Dropbox/NeuralResearch/FigsAfterReview/FvF30.jpg','-djpeg','-r300');