-
Notifications
You must be signed in to change notification settings - Fork 1
/
IM_pool.m
33 lines (27 loc) · 920 Bytes
/
IM_pool.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
function [ltw,emg,nrec] = IM_pool(excite,p,ttime,etime)
%%--------------------------------------------------------
%% this function simulates synchronous stimulation of a motor neuron pool
%% inputs are:
%% excite = absolute level of excitation
%% p = params of pool
%% ttime = time vector for force output
%% etime = time vector for emg output
%% outputs are:
%% ltw = muscle force obtained from stimulus
%% emg = emg output
%% nrec = number of units recruited for each level of excitation
twlin = zeros(length(ttime),p.n);
emglin = zeros(length(etime),p.n);
nrec = 0;
%% sim for each MN
for i=1:p.n
if excite >= p.rte(i)
%% do twitch function
twlin(:,i) = twitch(p.del,ttime,p.twtforce(i),p.tc(i));
emglin(:,i) = muap2(p.del,etime,p.twtforce(i));
nrec = nrec + 1;
end
end
ltw = sum(twlin,2)';
emg = sum(emglin,2)';
return