-
Notifications
You must be signed in to change notification settings - Fork 1
/
AnnWork.m
49 lines (44 loc) · 1.84 KB
/
AnnWork.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
% DesignANN
%
% C. T. Clarke based on work by Assad al Shueli
% Edited by L F Tiong 06/05/2016
%
% This code configures Matlab and trains a set of ANNs to detect APs at
% particular velocities.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Parameter setup
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Basic System parameters
Parameters = struct ( ...
'Electrodes', 10 , ...
'ElectrodeSpacing', 0.5e-3 , ...
'SamplingFrequency', 1e5 , ...
'ActionPotentialType', 'tmap2' , ...
'StartTestVelocity', 5 , ...
'StepTestVelocity', 1 , ...
'EndTestVelocity', 40 , ...
'MatchRepeats', 20 , ...
'NoiseLevel', 0 , ...
'AnnLength', [120, 1] , ...
'HiddenLayerSize', 1 , ...
'ActivationFcn1', 'tansig' , ...
'ActivationFcn2', 'purelin', ...
'ActivationFcn3', 'poslin', ...
'ActivationFcn4', 'softmax', ...
'TrainingMethod', 'trainlm', ...
'TargetOutput', 'pulse', ...
'MaxIterations', 100 , ...
'MinError', 0 , ...
'APType', 'BiPolar', ...
'channels', 5);
% ANN velocities to train for
%AnnVelocities = [80, 100, 120];
AnnVelocities = [10, 20, 30];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Design each ANN
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ANN = DesignAnn(AnnVelocities, Parameters);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Analyse the resultant ANNs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%AnalyseAnn(ANN, AnnVelocities, Parameters);