Mercurial > hg > map
comparison testPrograms/testOME.m @ 29:b51bf546ca3f
physiologyProb
author | Ray Meddis <rmeddis@essex.ac.uk> |
---|---|
date | Fri, 08 Jul 2011 13:48:27 +0100 |
parents | |
children | 25d53244d5c8 |
comparison
equal
deleted
inserted
replaced
28:02aa9826efe0 | 29:b51bf546ca3f |
---|---|
1 function testOME(paramsName, paramChanges) | |
2 | |
3 savePath=path; | |
4 addpath (['..' filesep 'utilities'],['..' filesep 'MAP']) | |
5 | |
6 if nargin<2 | |
7 paramChanges=[]; | |
8 end | |
9 | |
10 sampleRate=50000; | |
11 | |
12 dt=1/sampleRate; | |
13 leveldBSPL=80; % dB SPL as used by Huber (may trigger AR) | |
14 amp=10^(leveldBSPL/20)*28e-6; | |
15 duration=.05; | |
16 time=dt: dt: duration; | |
17 | |
18 %% Comparison data (human) | |
19 % These data are taken directly from Huber 2001 (Fig. 4) | |
20 HuberFrequencies=[600 800 1000 2000 3000 4000 6000 8000]; | |
21 HuberDisplacementAt80dBSPL=[1.5E-9 1.5E-09 1.5E-09 1.0E-09 7.0E-10 ... | |
22 3.0E-10 2.0E-10 1.0E-10]; % m; | |
23 % HuberVelocityAt80dBSPL= 2*pi*HuberFrequencies.*HuberDisplacementAt80dBSPL; | |
24 | |
25 figure(2), clf, subplot(2,1,1) | |
26 set(2,'position',[5 349 268 327]) | |
27 semilogx(HuberFrequencies, 20*log10(HuberDisplacementAt80dBSPL/1e-10),... | |
28 'ko', 'MarkerFaceColor','k', 'Marker','o', 'markerSize',6) | |
29 hold on | |
30 | |
31 %% Generate test stimulus ................................................................. | |
32 | |
33 % independent test using discrete frequencies | |
34 peakResponses=[]; | |
35 peakTMpressure=[]; | |
36 frequencies=[200 400 HuberFrequencies 10000]; | |
37 for toneFrequency=frequencies | |
38 inputSignal=amp*sin(2*pi*toneFrequency*time); | |
39 | |
40 showPlotsAndDetails=0; | |
41 AN_spikesOrProbability='probability'; | |
42 % switch off AR & MOC (Huber's patients were deaf) | |
43 paramChanges{1}='OMEParams.rateToAttenuationFactorProb=0;'; | |
44 paramChanges{2}='DRNLParams.rateToAttenuationFactorProb = 0;'; | |
45 | |
46 global OMEoutput OMEextEarPressure TMoutput ARattenuation | |
47 % BF is irrelevant | |
48 MAP1_14(inputSignal, sampleRate, -1, ... | |
49 paramsName, AN_spikesOrProbability, paramChanges); | |
50 | |
51 peakDisplacement=max(OMEoutput(floor(end/2):end)); | |
52 peakResponses=[peakResponses peakDisplacement]; | |
53 | |
54 peakTMpressure=[peakTMpressure max(OMEextEarPressure)]; | |
55 disp([' AR attenuation (dB): ' num2str(20*log10(min(ARattenuation)))]) | |
56 end | |
57 | |
58 %% Report | |
59 disp('frequency displacement(m)') | |
60 % disp(num2str([frequencies' peakResponses'])) | |
61 fprintf('%6.0f \t%10.3e\n',[frequencies' peakResponses']') | |
62 | |
63 % stapes peak displacement | |
64 figure(2), subplot(2,1,1), hold on | |
65 semilogx(frequencies, 20*log10(peakResponses/1e-10), 'r', 'linewidth',4) | |
66 set(gca,'xScale','log') | |
67 % ylim([1e-11 1e-8]) | |
68 xlim([100 10000]), ylim([0 30]) | |
69 grid on | |
70 title(['stapes at ' num2str(leveldBSPL) ' (NB deaf)']) | |
71 ylabel('disp: dB re 1e-10m') | |
72 xlabel('stimulus frequency (Hz)') | |
73 legend({'Huber et al','model'},'location','southWest') | |
74 set(gcf,'name','OME') | |
75 | |
76 % external ear resonance | |
77 figure(2), subplot(2,1,2),hold off | |
78 semilogx(frequencies, 20*log10(peakTMpressure/28e-6)-leveldBSPL,... | |
79 'k', 'linewidth',2) | |
80 xlim([100 10000]) %, ylim([-10 30]) | |
81 grid on | |
82 title(['External ear resonances' ]) | |
83 ylabel('dB') | |
84 xlabel('frequency') | |
85 set(gcf,'name','OME: external resonances') | |
86 % ---------------------------------------------------------- display parameters | |
87 disp(['parameter file was: ' paramsName]) | |
88 fprintf('\n') | |
89 | |
90 path(savePath); |