-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexampleStimSet.m
More file actions
executable file
·75 lines (70 loc) · 1.99 KB
/
exampleStimSet.m
File metadata and controls
executable file
·75 lines (70 loc) · 1.99 KB
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
function stimSet_012(exptInfo,preExptData)
% To play a range of stimuli for 15um piezo
%% Set up and acquire with the stimulus set
numberOfStimuli = 21;
stimRan = randperm(numberOfStimuli);
count = 1;
repeat = 1;
while repeat < 3
trialMeta.stimNum = stimRan(count);
fprintf(['\nStimNum = ',num2str(trialMeta.stimNum)])
fprintf(['\nRepeatNum = ',num2str(repeat)])
stim = pickStimulus(trialMeta.stimNum);
acquireTrial('i',stim,exptInfo,preExptData,trialMeta);
if count == numberOfStimuli
count = 1;
stimRan = randperm(numberOfStimuli);
repeat = repeat + 1;
else
count = count+1;
end
end
end
function stim = pickStimulus(stimNum)
switch stimNum
case 1
stim = PipStimulus;
stim.speaker = 2;
stim.maxVoltage = 4;
case 2
stim = Chirp;
stim.speaker = 2;
stim.maxVoltage = 4;
stim.startFrequency = 400;
stim.endFrequency = 17;
stim.mode = 'piezo';
case 3
stim = Chirp;
stim.startFrequency = 17;
stim.endFrequency = 400;
stim.maxVoltage = 4;
stim.mode = 'piezo';
case 4
stim = CourtshipSong;
stim.speaker = 2;
stim.maxVoltage = 4;
case 5
stim = PulseSong;
stim.speaker = 2;
stim.maxVoltage = 4;
case 6
stim = SquareWave;
stim.speaker = 2;
stim.maxVoltage = 4;
case num2cell(7:16)
freqRange = 25.*sqrt(2).^((-1:8));
stimNumStart = 7-1;
freqNum = stimNum - stimNumStart;
stim = SineWave;
stim.carrierFreqHz = freqRange(freqNum);
stim.maxVoltage = 4;
case num2cell(17:21)
modFreqRange = 2.^(0:4);
stimNumStart = 17-1;
modFreqNum = stimNum - stimNumStart;
stim = AmTone;
stim.carrierFreqHz = 300;
stim.modFreqHz = modFreqRange(modFreqNum);
stim.maxVoltage = 4;
end
end