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 / testOME.m @ 38:c2204b18f4a2
History | View | Annotate | Download (3.23 KB)
| 1 | 29:b51bf546ca3f | rmeddis | function testOME(paramsName, paramChanges) |
|---|---|---|---|
| 2 | 38:c2204b18f4a2 | rmeddis | % testOME compute the external resonance and |
| 3 | % stapes response at a number of frequencies |
||
| 4 | % It compares the stapes displacement against human in vivo data |
||
| 5 | 35:25d53244d5c8 | rmeddis | % collected by Huber et al.2001. |
| 6 | 38:c2204b18f4a2 | rmeddis | % paramsName: name of file in parameterStore containing model parameters |
| 7 | % paramchanges: string array of changes to parameters. |
||
| 8 | % this can be omitted or {} is acceptable argument
|
||
| 9 | % |
||
| 10 | 35:25d53244d5c8 | rmeddis | % testOME('Normal',{})
|
| 11 | 29:b51bf546ca3f | rmeddis | |
| 12 | savePath=path; |
||
| 13 | addpath (['..' filesep 'utilities'],['..' filesep 'MAP']) |
||
| 14 | |||
| 15 | 38:c2204b18f4a2 | rmeddis | % default arguments |
| 16 | 29:b51bf546ca3f | rmeddis | if nargin<2 |
| 17 | paramChanges=[]; |
||
| 18 | end |
||
| 19 | 38:c2204b18f4a2 | rmeddis | if nargin<1 |
| 20 | paramsName='Normal'; |
||
| 21 | end |
||
| 22 | 29:b51bf546ca3f | rmeddis | |
| 23 | sampleRate=50000; |
||
| 24 | |||
| 25 | dt=1/sampleRate; |
||
| 26 | leveldBSPL=80; % dB SPL as used by Huber (may trigger AR) |
||
| 27 | amp=10^(leveldBSPL/20)*28e-6; |
||
| 28 | duration=.05; |
||
| 29 | time=dt: dt: duration; |
||
| 30 | |||
| 31 | %% Comparison data (human) |
||
| 32 | % These data are taken directly from Huber 2001 (Fig. 4) |
||
| 33 | HuberFrequencies=[600 800 1000 2000 3000 4000 6000 8000]; |
||
| 34 | HuberDisplacementAt80dBSPL=[1.5E-9 1.5E-09 1.5E-09 1.0E-09 7.0E-10 ... |
||
| 35 | 3.0E-10 2.0E-10 1.0E-10]; % m; |
||
| 36 | % HuberVelocityAt80dBSPL= 2*pi*HuberFrequencies.*HuberDisplacementAt80dBSPL; |
||
| 37 | |||
| 38 | 35:25d53244d5c8 | rmeddis | figure(2), clf, subplot(2,1,2) |
| 39 | 29:b51bf546ca3f | rmeddis | set(2,'position',[5 349 268 327]) |
| 40 | semilogx(HuberFrequencies, 20*log10(HuberDisplacementAt80dBSPL/1e-10),... |
||
| 41 | 'ko', 'MarkerFaceColor','k', 'Marker','o', 'markerSize',6) |
||
| 42 | hold on |
||
| 43 | |||
| 44 | %% Generate test stimulus ................................................................. |
||
| 45 | |||
| 46 | % independent test using discrete frequencies |
||
| 47 | peakResponses=[]; |
||
| 48 | peakTMpressure=[]; |
||
| 49 | frequencies=[200 400 HuberFrequencies 10000]; |
||
| 50 | for toneFrequency=frequencies |
||
| 51 | inputSignal=amp*sin(2*pi*toneFrequency*time); |
||
| 52 | |||
| 53 | showPlotsAndDetails=0; |
||
| 54 | AN_spikesOrProbability='probability'; |
||
| 55 | 35:25d53244d5c8 | rmeddis | |
| 56 | 29:b51bf546ca3f | rmeddis | % switch off AR & MOC (Huber's patients were deaf) |
| 57 | 35:25d53244d5c8 | rmeddis | idx=length(paramChanges); |
| 58 | paramChanges{idx+1}='OMEParams.rateToAttenuationFactorProb=0;';
|
||
| 59 | paramChanges{idx+2}='DRNLParams.rateToAttenuationFactorProb = 0;';
|
||
| 60 | 29:b51bf546ca3f | rmeddis | |
| 61 | global OMEoutput OMEextEarPressure TMoutput ARattenuation |
||
| 62 | % BF is irrelevant |
||
| 63 | MAP1_14(inputSignal, sampleRate, -1, ... |
||
| 64 | paramsName, AN_spikesOrProbability, paramChanges); |
||
| 65 | |||
| 66 | peakDisplacement=max(OMEoutput(floor(end/2):end)); |
||
| 67 | peakResponses=[peakResponses peakDisplacement]; |
||
| 68 | |||
| 69 | peakTMpressure=[peakTMpressure max(OMEextEarPressure)]; |
||
| 70 | end |
||
| 71 | |||
| 72 | %% Report |
||
| 73 | disp('frequency displacement(m)')
|
||
| 74 | % disp(num2str([frequencies' peakResponses'])) |
||
| 75 | fprintf('%6.0f \t%10.3e\n',[frequencies' peakResponses']')
|
||
| 76 | |||
| 77 | % stapes peak displacement |
||
| 78 | 35:25d53244d5c8 | rmeddis | figure(2), subplot(2,1,2), hold on |
| 79 | 29:b51bf546ca3f | rmeddis | semilogx(frequencies, 20*log10(peakResponses/1e-10), 'r', 'linewidth',4) |
| 80 | set(gca,'xScale','log') |
||
| 81 | % ylim([1e-11 1e-8]) |
||
| 82 | xlim([100 10000]), ylim([0 30]) |
||
| 83 | grid on |
||
| 84 | 35:25d53244d5c8 | rmeddis | title(['stapes at ' num2str(leveldBSPL)]) |
| 85 | 29:b51bf546ca3f | rmeddis | ylabel('disp: dB re 1e-10m')
|
| 86 | xlabel('stimulus frequency (Hz)')
|
||
| 87 | legend({'Huber et al','model'},'location','southWest')
|
||
| 88 | set(gcf,'name','OME') |
||
| 89 | |||
| 90 | % external ear resonance |
||
| 91 | 35:25d53244d5c8 | rmeddis | figure(2), subplot(2,1,1),hold off |
| 92 | 29:b51bf546ca3f | rmeddis | semilogx(frequencies, 20*log10(peakTMpressure/28e-6)-leveldBSPL,... |
| 93 | 'k', 'linewidth',2) |
||
| 94 | xlim([100 10000]) %, ylim([-10 30]) |
||
| 95 | grid on |
||
| 96 | title(['External ear resonances' ]) |
||
| 97 | ylabel('dB')
|
||
| 98 | xlabel('frequency')
|
||
| 99 | set(gcf,'name','OME: external resonances') |
||
| 100 | % ---------------------------------------------------------- display parameters |
||
| 101 | disp(['parameter file was: ' paramsName]) |
||
| 102 | fprintf('\n')
|
||
| 103 | |||
| 104 | path(savePath); |