To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

The primary repository for this project is hosted at git://github.com/rmeddis/MAP.git .
This repository is a read-only copy which is updated automatically every hour.

Statistics Download as Zip
| Branch: | Revision:

root / testPrograms / oldTestPrograms / MAPtwoToneDemo1D.m @ 38:c2204b18f4a2

History | View | Annotate | Download (4.63 KB)

1 38:c2204b18f4a2 rmeddis
% function MAPtwoToneDemo
2
% Not for distribution but code worth keeping
3
% Demonstration of two-tone suppression in the AN using a
4
%   single channel
5
%
6
7
dbstop if error
8
% create access to all MAP 1_8 facilities
9
% addpath ('..\modules', '..\utilities',  '..\parameterStore',  '..\wavFileStore' , '..\testPrograms')
10
addpath (['..' filesep 'modules'], ['..' filesep 'utilities'],  ['..' filesep 'parameterStore'],  ['..' filesep 'wavFileStore'] , ['..' filesep 'testPrograms'])
11
12
moduleSequence= 1:7;  	% up to the AN
13
figure(3), clf
14
primaryToneFrequency=2000;
15
suppressorFrequency=primaryToneFrequency*1.5;
16
17
primaryDB=30;
18
suppressors=20:10:80;
19
frameCount=0;
20
for suppressorDB=suppressors
21
    frameCount=frameCount+1;
22
    lowestBF=1000; 	highestBF= 5000; 	numChannels=30;
23
    BFlist=round(logspace(log10(lowestBF), log10(highestBF), numChannels));
24
    BFlist=2000;
25
    duration=.020;		      % seconds
26
    sampleRate= 40000; % Hz (higher sample rate needed for BF>8000 Hz)
27
    dt=1/sampleRate; % seconds
28
29
    % for conditionNo=1:3  % probe alone/ suppressor alone/ combined
30
    for conditionNo=1:3  % probe alone/ suppressor alone/ combined
31
        switch conditionNo
32
            case 1
33
                primaryLevelDB=primaryDB;
34
                suppressorLevelDB= -100;
35
                plotGuide.subPlotNo=	1;     % initialize subplot count
36
                figureTitle=['probe alone:  ' num2str(primaryToneFrequency) ' Hz;   ' num2str(primaryLevelDB) ' dB SPL'];
37
38
            case 2
39
                primaryLevelDB=-100;
40
                suppressorLevelDB=suppressorDB;
41
                plotGuide.subPlotNo=	2;     % initialize subplot count
42
                figureTitle=['suppressor alone:  ' num2str(suppressorFrequency) ' Hz;   ' num2str(suppressorLevelDB) ' dB SPL'];
43
            case 3
44
                primaryLevelDB=primaryDB;
45
                suppressorLevelDB=suppressorDB;
46
                plotGuide.subPlotNo=	3;     % initialize subplot count
47
                figureTitle=['probe + suppressor'];
48
        end
49
50
        % primary BF tone
51
        time1=dt: dt: duration;
52
        amp=10^(primaryLevelDB/20)*28e-6;
53
        inputSignal=amp*sin(2*pi*primaryToneFrequency*time1);
54
        rampDuration=.005; rampTime=dt:dt:rampDuration;
55
        ramp=[0.5*(1+cos(2*pi*rampTime/(2*rampDuration)+pi)) ones(1,length(time1)-length(rampTime))];
56
        inputSignal=inputSignal.*ramp;
57
        inputSignal=inputSignal.*fliplr(ramp);
58
59
        % suppressor
60
        tone2Duration=duration/2; % s
61
        time2= dt: dt: tone2Duration;
62
        % B: tone on
63
        amp=10^(suppressorLevelDB/20)*28e-6;
64
        inputSignal2=amp*sin(2*pi*suppressorFrequency*time2);
65
        rampDuration=.005; rampTime=dt:dt:rampDuration;
66
        ramp=[0.5*(1+cos(2*pi*rampTime/(2*rampDuration)+pi)) ones(1,length(time2)-length(rampTime))];
67
        inputSignal2=inputSignal2.*ramp;
68
        % A: initial silence (delay to suppressor)
69
        silence=zeros(1,length(time2));
70
        inputSignal2=[silence inputSignal2];
71
72
        % add tone and suppressor components
73
        inputSignal=inputSignal+inputSignal2;
74
75
        % specify model parameters
76
        method=MAPparamsDEMO(BFlist, sampleRate);
77
        % parameter change (must be global to take effect)
78
        global   AN_IHCsynapseParams
79
        AN_IHCsynapseParams.mode=	'probability';
80
%         method.useEfferent=0;
81
82
        method.plotGraphs=	1;	   % please plot
83
84
        figure(4), subplot(3,1,conditionNo)
85
        plot(time1, inputSignal, 'k')% *************
86
87
        [ANresponse, method, A]=MAPsequenceSeg(inputSignal, method, moduleSequence);
88
        response{conditionNo}=ANresponse;
89
% 	F(frameCount) = getframe(gcf);
90
    end
91
92
%     peakResponse=max(max([response{1} response{2} response{3}]));
93
%     figure(3), subplot(4,1,1)
94
%     mesh((response{1}), [0 peakResponse])
95
%     title(['primary: ' num2str(primaryDB) ' dB SPL'])
96
%     zlim([0 5000]), view([-28 36])
97
%
98
%     figure(3), subplot(4,1,2)
99
%     mesh((response{2}), [0 peakResponse])
100
%     title(['suppressor: ' num2str(suppressorDB) ' dB SPL'])
101
%     zlim([0 5000]),  view([-28 36])
102
%
103
%     figure(3), subplot(4,1,3)
104
%     mesh((response{3}), [0 peakResponse])
105
%     title([' primary + suppressor '])
106
%     zlim([0 5000]), view([-28 36])
107
%
108
%     figure(3), subplot(4,1,4)
109
%     sum= response{3}-response{1}-response{2};
110
%     mesh(sum)
111
%     zlim([-2000 2000])
112
%     title(' difference matrix (combined - primary - suppressor)')
113
%     view([-28 20])
114
%     disp( [num2str([ suppressorDB primaryDB max(max(sum))])] )
115
%
116
%     colormap(jet)
117
    pause(1)
118
end
119
120
figure(4)
121
xlabel('time (s)')
122
figure(3)
123
xlabel('time (s)')
124
125
%  figure(99), movie(F, 1, 1)
126
% UTIL_showAllMAPStructures