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.
root / testPrograms / test2toneMovie.m @ 38:c2204b18f4a2
History | View | Annotate | Download (4.41 KB)
| 1 | 38:c2204b18f4a2 | rmeddis | % function test2toneMovie |
|---|---|---|---|
| 2 | % |
||
| 3 | % Demonstration of two-tone suppression in the AN using a |
||
| 4 | % F1 tone suppressed by a 1.5*F1 kHz tone |
||
| 5 | % |
||
| 6 | |||
| 7 | global ANprobRateOutput DRNLoutput |
||
| 8 | dbstop if error |
||
| 9 | restorePath=path; |
||
| 10 | addpath (['..' filesep 'MAP'], ['..' filesep 'wavFileStore'], ... |
||
| 11 | ['..' filesep 'utilities']) |
||
| 12 | figure(5), clf |
||
| 13 | |||
| 14 | disp('')
|
||
| 15 | primaryToneFrequency=8000; |
||
| 16 | |||
| 17 | probedBs=10 :10: 50; |
||
| 18 | nProbeLevels=length(probedBs); |
||
| 19 | |||
| 20 | % disp(['F1 F1 level= ' num2str([primaryToneFrequency probedB])]) |
||
| 21 | |||
| 22 | suppressorLevels=0:10:80; |
||
| 23 | |||
| 24 | lowestBF=250; highestBF= 8000; numChannels=21; |
||
| 25 | BFlist=round(logspace(log10(lowestBF), log10(highestBF), numChannels)); |
||
| 26 | % fix so that probe is middle range and is at a BF |
||
| 27 | BFlist=BFlist*primaryToneFrequency/2000; |
||
| 28 | suppressorFrequencies=BFlist; |
||
| 29 | BFchannel=find(round(BFlist)==round(primaryToneFrequency)); |
||
| 30 | |||
| 31 | sampleRate= 100000; % Hz (higher sample rate needed for BF>8000 Hz) |
||
| 32 | dt=1/sampleRate; % seconds |
||
| 33 | |||
| 34 | duration=.050; % seconds |
||
| 35 | tone2Duration=duration/2; % s |
||
| 36 | startSilenceDuration=0.010; |
||
| 37 | startSilence=... |
||
| 38 | zeros(1,startSilenceDuration*sampleRate); |
||
| 39 | suppressorStartsPTR=... |
||
| 40 | round((startSilenceDuration+duration/2)*sampleRate); |
||
| 41 | |||
| 42 | probedBCount=0; |
||
| 43 | for probedB=probedBs |
||
| 44 | probedBCount=probedBCount+1; |
||
| 45 | |||
| 46 | peakResponse= zeros(length(suppressorLevels),length(suppressorFrequencies)); |
||
| 47 | suppFreqCount=0; |
||
| 48 | for suppressorFrequency=suppressorFrequencies |
||
| 49 | suppFreqCount=suppFreqCount+1; |
||
| 50 | |||
| 51 | suppressorLevelCount=0; |
||
| 52 | for suppressorDB=suppressorLevels |
||
| 53 | suppressorLevelCount=suppressorLevelCount+1; |
||
| 54 | |||
| 55 | % primary + suppressor |
||
| 56 | primaryLevelDB=probedB; |
||
| 57 | suppressorLevelDB=suppressorDB; |
||
| 58 | |||
| 59 | |||
| 60 | % primary BF tone |
||
| 61 | time1=dt: dt: duration; |
||
| 62 | amp=10^(primaryLevelDB/20)*28e-6; |
||
| 63 | inputSignal=amp*sin(2*pi*primaryToneFrequency*time1); |
||
| 64 | rampDuration=.005; rampTime=dt:dt:rampDuration; |
||
| 65 | ramp=[0.5*(1+cos(2*pi*rampTime/(2*rampDuration)+pi)) ones(1,length(time1)-length(rampTime))]; |
||
| 66 | inputSignal=inputSignal.*ramp; |
||
| 67 | inputSignal=inputSignal.*fliplr(ramp); |
||
| 68 | |||
| 69 | % suppressor |
||
| 70 | time2= dt: dt: tone2Duration; |
||
| 71 | % B: tone on |
||
| 72 | amp=10^(suppressorLevelDB/20)*28e-6; |
||
| 73 | inputSignal2=amp*sin(2*pi*suppressorFrequency*time2); |
||
| 74 | rampDuration=.005; rampTime=dt:dt:rampDuration; |
||
| 75 | ramp=[0.5*(1+cos(2*pi*rampTime/(2*rampDuration)+pi)) ones(1,length(time2)-length(rampTime))]; |
||
| 76 | inputSignal2=inputSignal2.*ramp; |
||
| 77 | inputSignal2=inputSignal2.*fliplr(ramp); |
||
| 78 | % A: initial silence (delay to suppressor) |
||
| 79 | silence=zeros(1,length(time2)); |
||
| 80 | inputSignal2=[silence inputSignal2]; |
||
| 81 | |||
| 82 | % add tone and suppressor components |
||
| 83 | inputSignal=inputSignal+inputSignal2; |
||
| 84 | |||
| 85 | inputSignal=... |
||
| 86 | [startSilence inputSignal ]; |
||
| 87 | |||
| 88 | % run MAP |
||
| 89 | MAPparamsName='Normal'; |
||
| 90 | AN_spikesOrProbability='probability'; |
||
| 91 | paramChanges={'IHCpreSynapseParams.tauCa=80e-6;'};
|
||
| 92 | MAP1_14(inputSignal, sampleRate, BFlist, ... |
||
| 93 | MAPparamsName, AN_spikesOrProbability, paramChanges); |
||
| 94 | |||
| 95 | response=ANprobRateOutput; |
||
| 96 | peakResponse(suppressorLevelCount,suppFreqCount)=... |
||
| 97 | mean(response(BFchannel,suppressorStartsPTR:end)); |
||
| 98 | disp(['F2 level= ', num2str([suppressorFrequency suppressorDB ... |
||
| 99 | peakResponse(suppressorLevelCount,suppFreqCount)])]) |
||
| 100 | |||
| 101 | |||
| 102 | %% make movie |
||
| 103 | figure(6), subplot(4,1,2) |
||
| 104 | axis tight |
||
| 105 | set(gca,'nextplot','replacechildren'); |
||
| 106 | plot(dt:dt:dt*length(inputSignal), inputSignal, 'k') |
||
| 107 | ylim([-.5 .5]) |
||
| 108 | |||
| 109 | figure(6), subplot(2,1,2) |
||
| 110 | PSTHbinWidth=0.010; |
||
| 111 | PSTH= UTIL_PSTHmakerb(... |
||
| 112 | response, dt, PSTHbinWidth); |
||
| 113 | [nY nX]=size(PSTH); |
||
| 114 | time=PSTHbinWidth*(0:nX-1); |
||
| 115 | surf(time, BFlist, PSTH) |
||
| 116 | zlim([0 500]), |
||
| 117 | caxis([0 500]) |
||
| 118 | shading interp |
||
| 119 | colormap(jet) |
||
| 120 | set(gca, 'yScale','log') |
||
| 121 | xlim([0 max(time)+dt]) |
||
| 122 | ylim([0 max(BFlist)]) |
||
| 123 | view([0 90]) % view([-8 68]) |
||
| 124 | title([' primary + suppressor ']) |
||
| 125 | |||
| 126 | end |
||
| 127 | end |
||
| 128 | |||
| 129 | %% plot matrix |
||
| 130 | |||
| 131 | peakResponse=peakResponse/peakResponse(1,1); |
||
| 132 | |||
| 133 | figure(5), subplot(2,nProbeLevels, probedBCount) |
||
| 134 | surf(suppressorFrequencies,suppressorLevels,peakResponse) |
||
| 135 | shading interp |
||
| 136 | view([0 90]) |
||
| 137 | set(gca,'Xscale','log') |
||
| 138 | xlim([min(suppressorFrequencies) max(suppressorFrequencies)]) |
||
| 139 | set(gca,'Xtick', [1000 4000],'xticklabel',{'1000', '4000'})
|
||
| 140 | title([num2str(primaryToneFrequency) ' Hz']) |
||
| 141 | |||
| 142 | subplot(2,nProbeLevels,nProbeLevels+probedBCount) |
||
| 143 | contourf(suppressorFrequencies,suppressorLevels,peakResponse, ... |
||
| 144 | [.1:.1:.9 0.99] ) |
||
| 145 | set(gca,'Xscale','log') |
||
| 146 | set(gca,'Xtick', [1000 4000],'xticklabel',{'1000', '4000'})
|
||
| 147 | set(gcf, 'name',['primaryToneFrequency= ' num2str(primaryToneFrequency)]) |
||
| 148 | title([num2str(probedB) ' dB']) |
||
| 149 | end |
||
| 150 | |||
| 151 | path=restorePath; |