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 / userProgramsRM / MAPdemoMultiChOAE.m @ 38:c2204b18f4a2
History | View | Annotate | Download (3.26 KB)
| 1 | 38:c2204b18f4a2 | rmeddis | function [frequencies fft_ampdB]= ... |
|---|---|---|---|
| 2 | MAPdemoMultiChOAE (leveldBSPL, toneFrequencies) |
||
| 3 | % MAPdemo runs the MATLAB auditory periphery model |
||
| 4 | % |
||
| 5 | % The OAE is simulated by combining the output from all DRNL channels |
||
| 6 | % |
||
| 7 | % arguments leveldBSPL and toneFrequencies are optional |
||
| 8 | % defaults are 70 and [5000 6000] |
||
| 9 | % |
||
| 10 | % e.g. |
||
| 11 | % MAPdemoMultiChOAE (60, [3000 4000]) |
||
| 12 | |||
| 13 | |||
| 14 | global dt DRNLoutput |
||
| 15 | dbstop if error |
||
| 16 | restorePath=path; |
||
| 17 | addpath (['..' filesep 'MAP'], ['..' filesep 'utilities'], ... |
||
| 18 | ['..' filesep 'parameterStore'], ['..' filesep 'wavFileStore'],... |
||
| 19 | ['..' filesep 'testPrograms']) |
||
| 20 | |||
| 21 | % set parameter file here |
||
| 22 | paramsName='Normal'; |
||
| 23 | % choose probability because spikes not used to evaluate BM |
||
| 24 | AN_spikesOrProbability='probability'; |
||
| 25 | % add parameter changes here. paramchanges is a cell array of command |
||
| 26 | % strings |
||
| 27 | paramChanges={};
|
||
| 28 | |||
| 29 | % DRNL channels |
||
| 30 | lowestBF=1000; highestBF= 8000; numChannels=41; |
||
| 31 | % includes BFs at 250 500 1000 2000 4000 8000 (for 11, 21, 31 BFs) |
||
| 32 | % the output from all these filters will be combined to form the OAE |
||
| 33 | BFlist=round(logspace(log10(lowestBF), log10(highestBF), numChannels)); |
||
| 34 | |||
| 35 | if nargin<2 |
||
| 36 | toneFrequencies= 2000; % single pure tone test |
||
| 37 | toneFrequencies=[ 2000 3000]; % F1 F2 for DPOAEs |
||
| 38 | toneFrequencies=[ 5000 6000]; % F1 F2 |
||
| 39 | end |
||
| 40 | duration=0.05; % seconds |
||
| 41 | duration=0.05; % seconds |
||
| 42 | rampDuration=.005; |
||
| 43 | |||
| 44 | if nargin<1 |
||
| 45 | leveldBSPL=70; % dB SPL |
||
| 46 | end |
||
| 47 | amp=10^(leveldBSPL/20)*28e-6; % converts to Pascals (peak level) |
||
| 48 | |||
| 49 | % Create pure stimulus |
||
| 50 | sampleRate= 100000; |
||
| 51 | dt=1/sampleRate; |
||
| 52 | time=dt: dt: duration; |
||
| 53 | inputSignal=sum(sin(2*pi*toneFrequencies'*time), 1); |
||
| 54 | inputSignal=amp*inputSignal; |
||
| 55 | |||
| 56 | % apply ramps |
||
| 57 | if rampDuration>0.5*duration, rampDuration=duration/2; end |
||
| 58 | rampTime=dt:dt:rampDuration; |
||
| 59 | ramp=[0.5*(1+cos(2*pi*rampTime/(2*rampDuration)+pi)) ... |
||
| 60 | ones(1,length(time)-length(rampTime))]; |
||
| 61 | inputSignal=inputSignal.*ramp; % at the beginning |
||
| 62 | ramp=fliplr(ramp); |
||
| 63 | inputSignal=inputSignal.*ramp; % and at the end |
||
| 64 | |||
| 65 | % add 10 ms silence |
||
| 66 | silenceDuration=0.01; |
||
| 67 | silence= zeros(1,round(silenceDuration/dt)); |
||
| 68 | inputSignal= [silence inputSignal silence]; |
||
| 69 | time=dt: dt: dt*length(inputSignal); |
||
| 70 | |||
| 71 | %% delare 'showMap' options to control graphical output |
||
| 72 | showMapOptions.printModelParameters=0; % prints all parameters |
||
| 73 | showMapOptions.showModelOutput=1; % plot of all stages |
||
| 74 | showMapOptions.printFiringRates=1; % prints stage activity levels |
||
| 75 | showMapOptions.showACF=0; % shows SACF (probability only) |
||
| 76 | showMapOptions.showEfferent=0; % tracks of AR and MOC |
||
| 77 | showMapOptions.surfProbability=0; % 2D plot of HSR response |
||
| 78 | showMapOptions.surfSpikes=0; % 2D plot of spikes histogram |
||
| 79 | showMapOptions.ICrates=0; % IC rates by CNtauGk |
||
| 80 | |||
| 81 | |||
| 82 | MAP1_14(inputSignal, 1/dt, BFlist, ... |
||
| 83 | paramsName, AN_spikesOrProbability, paramChanges); |
||
| 84 | |||
| 85 | UTIL_showMAP(showMapOptions, paramChanges) |
||
| 86 | pause(0.1) |
||
| 87 | |||
| 88 | % use this to produce a comnplete record of model parameters |
||
| 89 | % UTIL_showAllMAPStructures |
||
| 90 | |||
| 91 | OAE=sum(DRNLoutput); |
||
| 92 | figure(5),subplot(2,1,1) |
||
| 93 | plot(time,OAE) |
||
| 94 | title(['F=' num2str(toneFrequencies)]) |
||
| 95 | [fft_powerdB, fft_phase, frequencies, fft_ampdB]= UTIL_FFT(OAE, dt, 1e-15); |
||
| 96 | idx=find(frequencies<1e4); |
||
| 97 | |||
| 98 | figure(5),subplot(2,1,2) |
||
| 99 | plot(frequencies(idx),fft_ampdB(idx)) |
||
| 100 | title ('FFT of OAE')
|
||
| 101 | ylabel('dB')
|
||
| 102 | ylim([0 100]) |
||
| 103 | grid on |
||
| 104 | |||
| 105 | path(restorePath); |