Home > voicebox > psycdigit.m

psycdigit

PURPOSE ^

y=proc(x,fs,i,r) % process noisy waveform x through model i with parameters r

SYNOPSIS ^

function [m,v]=psycdigit(proc,r,mode,p,q,xp,noise,fn,dfile,ofile)

DESCRIPTION ^

 y=proc(x,fs,i,r)  % process noisy waveform x through model i with parameters r
 y=proc(x,fs,snr,i,r) % process clean speech degraded to snr through model i with parameters r
 y=proc()   % return comment text string describing algorithm ('c' option only)
 Inputs:
         proc    processing function handle (e.g. @specsub)
         r       parameters for proc (omitted from call if r=[])
         mode    see below
         p,q,xp  parameters passed on to psycest or psycestu
         noise   noise waveform or wav file containing noise
         fn      noise waveform sample frequency [16000]
         dfile   path to TIdigits folder
         ofile   output text file

 mode options:
         a       proc adds its own noise
         b*      base figure number [100]
         c       y=proc() returns comment string
        [ d       score as single digits ]
        e/E*       plot evolving psychometric functions *=1,2,3 for mean, mode, marginal mode (F=after each trial)
         f/F*       plot psychometric functions *=1,2,3 for mean, mode, marginal mode (F=after each trial)
        g       prompt with number of digits
         G       prompt with SNR
        [ i/I    plot SRT improvement (I=after each trial) ]
        [ j*      scaling: 0=autoscale each token, 1=constant speech, 2=const noise, 3=const noisy ]
         l*      min token length (in digits)
         L*      max token length (if different from min)
         m*      use * external models [default 1]
         M       include an extra model with no processing
         n*      *=average number of trials per model
        [N*       ignore the first * trials ]
         [o/O    write to output file, O write result of each probe]
         p/P       plot pdf (P=after each trial)
         r       allow repetitions
         s      respond s to save the noisy stimulus as a .wav file
        [ S     save all stimuli as wav files ]
         t/T*    taper noise */10 seconds at start and end
        [ u      do not normalize the noise level ]
         v/V*       plot srt/slope convergence (C= after each trial) *=1,2,3 for mean, mode, marginal mode
        [ w       white noise instead of speech-shaped ]
         x*      add */10 seconds of noise to the front of the speech before processing
         X*      truncate */10 seconds from the start of the processed speech
         z       omit tokens containing "oh"
         Z       omit tokens containing "zero"

 Output file format
   Each line starts 'x ' where x is one of the following
       %  Comment
       V  File version type
       O  mode options
       P  details about proc
       C  Comment returned by proc
       M  measurement

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [m,v]=psycdigit(proc,r,mode,p,q,xp,noise,fn,dfile,ofile)
0002 % y=proc(x,fs,i,r)  % process noisy waveform x through model i with parameters r
0003 % y=proc(x,fs,snr,i,r) % process clean speech degraded to snr through model i with parameters r
0004 % y=proc()   % return comment text string describing algorithm ('c' option only)
0005 % Inputs:
0006 %         proc    processing function handle (e.g. @specsub)
0007 %         r       parameters for proc (omitted from call if r=[])
0008 %         mode    see below
0009 %         p,q,xp  parameters passed on to psycest or psycestu
0010 %         noise   noise waveform or wav file containing noise
0011 %         fn      noise waveform sample frequency [16000]
0012 %         dfile   path to TIdigits folder
0013 %         ofile   output text file
0014 %
0015 % mode options:
0016 %         a       proc adds its own noise
0017 %         b*      base figure number [100]
0018 %         c       y=proc() returns comment string
0019 %        [ d       score as single digits ]
0020 %        e/E*       plot evolving psychometric functions *=1,2,3 for mean, mode, marginal mode (F=after each trial)
0021 %         f/F*       plot psychometric functions *=1,2,3 for mean, mode, marginal mode (F=after each trial)
0022 %        g       prompt with number of digits
0023 %         G       prompt with SNR
0024 %        [ i/I    plot SRT improvement (I=after each trial) ]
0025 %        [ j*      scaling: 0=autoscale each token, 1=constant speech, 2=const noise, 3=const noisy ]
0026 %         l*      min token length (in digits)
0027 %         L*      max token length (if different from min)
0028 %         m*      use * external models [default 1]
0029 %         M       include an extra model with no processing
0030 %         n*      *=average number of trials per model
0031 %        [N*       ignore the first * trials ]
0032 %         [o/O    write to output file, O write result of each probe]
0033 %         p/P       plot pdf (P=after each trial)
0034 %         r       allow repetitions
0035 %         s      respond s to save the noisy stimulus as a .wav file
0036 %        [ S     save all stimuli as wav files ]
0037 %         t/T*    taper noise */10 seconds at start and end
0038 %        [ u      do not normalize the noise level ]
0039 %         v/V*       plot srt/slope convergence (C= after each trial) *=1,2,3 for mean, mode, marginal mode
0040 %        [ w       white noise instead of speech-shaped ]
0041 %         x*      add */10 seconds of noise to the front of the speech before processing
0042 %         X*      truncate */10 seconds from the start of the processed speech
0043 %         z       omit tokens containing "oh"
0044 %         Z       omit tokens containing "zero"
0045 %
0046 % Output file format
0047 %   Each line starts 'x ' where x is one of the following
0048 %       %  Comment
0049 %       V  File version type
0050 %       O  mode options
0051 %       P  details about proc
0052 %       C  Comment returned by proc
0053 %       M  measurement
0054 
0055 % Bugs/Suggestions
0056 % (1) Add sounds to indicate error and end of test
0057 % (2) Routine could return a label to replace "SNR" in necessary
0058 % (3) Add an input option to "discard" this sample
0059 % (4) output file should include mode argument + date + IP address + computer name + r arguments + p/q values
0060 % (5) Quote filenames in output file or else never have anything else on the line
0061 
0062 %      Copyright (C) Mike Brookes 2010
0063 %      Version: $Id: psycdigit.m 713 2011-10-16 14:45:43Z dmb $
0064 %
0065 %   VOICEBOX is a MATLAB toolbox for speech processing.
0066 %   Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html
0067 %
0068 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0069 %   This program is free software; you can redistribute it and/or modify
0070 %   it under the terms of the GNU General Public License as published by
0071 %   the Free Software Foundation; either version 2 of the License, or
0072 %   (at your option) any later version.
0073 %
0074 %   This program is distributed in the hope that it will be useful,
0075 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0076 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0077 %   GNU General Public License for more details.
0078 %
0079 %   You can obtain a copy of the GNU General Public License from
0080 %   http://www.gnu.org/copyleft/gpl.html or by writing to
0081 %   Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA.
0082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0083 
0084 %     25+4     m*      use * external models [default 1]
0085 %     26    M       include an extra model with no processing
0086 %      1   a       proc adds its own noise
0087 %      27+5   n*      *=average number of trials per model
0088 %     23+2    l*      min token length (in digits)
0089 %      24+3   L*      max token length (if different from min)
0090 %      7   d       score as single digits
0091 %      37   s       speech-shaped noise instead of white
0092 %       19+1  j*      scaling: 0=autoscale each token, 1=constant speech, 2=const noise, 3=const noisy
0093 %      35   r       allow repetitions
0094 %     41    u       unimodal psychometric function
0095 %     32    P       plot pdf
0096 %     31   p       plot srt convergence
0097 %     13    g       prompt with number of digits
0098 %      14   G       prompt with SNR
0099 %      47+6   x*      add */10 seconds of noise to the front of the speech
0100 %      48+7   X*      truncate */10 from the start of the processed speech
0101 % input parameters
0102 persistent tok mtok tigflgp digitsp
0103 if nargin<10
0104     ofile='';
0105     if nargin<9
0106         dfile='F:\home\dmb\data\old_speech\tidigits';
0107         %         dfile='Y:\Speech\TIDigits\Disc 1\TIDIGITS';
0108         if nargin<8
0109             fn=16000;
0110             if nargin<7
0111                 noise=[];
0112                 if nargin<6
0113                     xp=[];
0114                     if nargin<5
0115                         q=[];
0116                         if nargin<4
0117                             p=[];
0118                             if nargin<3
0119                                 mode='';
0120                                 if nargin<2
0121                                     r=[];
0122                                 end
0123                             end
0124                         end
0125                     end
0126                 end
0127             end
0128         end
0129     end
0130 end
0131 
0132 % parse the mode string
0133 
0134 i=1;
0135 pv=[0 3 3 1 25  0  0 1 1 1 1 100]; % pv default values if option is unspecified
0136 px=[0 3 3 1 25 20 18 1 1 1 1 100]; % pv values if option is given without a value
0137 pvs='jlLmnxXvVfFb';
0138 pf=zeros(1,52);
0139 mval=0;
0140 lmode=length(mode);
0141 while i<=lmode
0142     if i<lmode  % read a following integer if it exists
0143         [v,nv,e,ni]=sscanf(mode(i+1:end),'%d',1);
0144     else
0145         nv=0;
0146         ni=1;
0147     end
0148     j=find(mode(i)==pvs,1);
0149     k=1+2*(double(lower(mode(i)))-'a')+(mode(i)<'a');
0150     if k>=1 && k<=52
0151         pf(k)=1-pf(k);
0152         if ~isempty(j)
0153             if nv==0
0154                 pv(j)=px(j);
0155             else
0156                 pv(j)=v;
0157                 mval=mval || j==4;  % m has a value specified
0158             end
0159         end
0160     end
0161     i=i+ni;
0162 end
0163 
0164 % derived input parameters
0165 
0166 varthr=20;   % variance threshold for "silence"
0167 nxevo=30; % size of evloving pdf
0168 
0169 if pf(23)>pf(24) || pv(2)>pv(3)
0170     pv(3)=pv(2);                % Make max token length reasonable
0171 end
0172 if pf(24)>pf(23)
0173     pv(2)=1;                    % min =1 if only max is specified
0174 end
0175 zmodel=pv(4)+(pf(26)>0); % total number of models (including null model)
0176 ntrial=zmodel*pv(5);  % total number of trials
0177 if pf(12)>pf(11)    % 'F' specified but not 'f'
0178     pv(10)=pv(11);  % copy across the average type selector
0179 end
0180 if pf(11)+pf(12)>0 && (pv(10)<1 || pv(10)>3)
0181     error('Invalid average type for option f/F');
0182 end
0183 
0184 % sort out p argument to psycest or psycestu
0185 unimode=pf(41);
0186 if isempty(p)
0187     p=0.75;     % default recognition rate at threshold
0188 end
0189 if size(p,1)<3-unimode
0190     p(2-unimode,1)=0.04;     % miss probability
0191     p(3-unimode,1)=0;     % dummy entry for guess probability
0192 end
0193 if size(p,2)<(zmodel)
0194     p=p(:,1+mod(0:zmodel-1,size(p,2)));
0195 end
0196 
0197 % first sort out the digit samples
0198 
0199 tigflg=[pv(2:3) pf(51:52)];
0200 if isempty(tok) || any(tigflg~=tigflgp) || ~strcmp(dfile,digitsp)
0201     disp('Scanning TIDIGITS files ...');
0202     digitsp=dfile;
0203     tigflgp=tigflg;
0204     if any(dfile(end)=='/\')
0205         dfile(end)=[];  % remove a trailing separator
0206     end
0207     dirlist{1}='';
0208     ntok=0;
0209     mtok=zeros(1,pv(3));
0210     tok=cell(1,2);
0211     while ~isempty(dirlist)
0212         dd=dir([dfile dirlist{1}]);
0213         for i=1:length(dd)
0214             name=dd(i).name;
0215             if name(1)~='.'   % ignore directories starting with '.'
0216                 if dd(i).isdir
0217                     dirlist{end+1}=[dirlist{1} '\' name];
0218                 elseif length(name)>4 && strcmpi(name(end-3:end),'.wav')
0219                     digs=name(1:end-4);
0220                     digz=upper(digs)=='Z';
0221                     digo=upper(digs)=='O';
0222                     digs(digo | digz)='0';
0223                     digs=digs(digs>='0' & digs<='9');
0224                     ndigs=length(digs);
0225                     if ndigs>=tigflg(1) && ndigs<=tigflg(2) && ~(tigflg(3) && any(digo)) && ~(tigflg(4) && any(digz))
0226                         ntok=ntok+1;
0227                         mtok(ndigs)=mtok(ndigs)+1;
0228                         tok{ntok,1}=[dirlist{1} '\' name];
0229                         tok{ntok,2}=digs;
0230                     end
0231                 end
0232             end
0233         end
0234         dirlist(1)=[];  % remove this directory from the list
0235     end
0236 end
0237 ntok=size(tok,1);
0238     [s,fs]=readsph([dfile tok{1,1}]); % get the first speech token to set fs
0239     
0240 % calculate guess probability assuming you get the correct number of digits
0241 
0242 if any(mode=='d')
0243     p(3-unimode,:)=0.1;
0244 else
0245     p(3-unimode,:)=0.1.^(1:pv(3))*mtok'/ntok;
0246 end
0247 
0248 % now initialize the models
0249 
0250 if unimode
0251     [xx,ii,m,v]=psycestu(-zmodel,p,q,xp); % initialize all models
0252     [pact,qact]=psycestu(0);  % save the actual parameters
0253 else
0254     [xx,ii,m,v]=psycest(-zmodel,p,q,xp); % initialize all models
0255     [pact,qact]=psycest(0);  % save the actual parameters
0256 end
0257 if pv(4) && pf(5)
0258     x=[];  % set x=[] to force a description output
0259     ii=1;   % for now, only do model 1
0260     if pf(1)   % if process adds its own noise
0261         if isempty(r)
0262             if mval
0263                 procdesc=proc(x,fs,xx,ii);  % process the noisy speech
0264             else
0265                 procdesc=proc(x,fs,xx);  % process the noisy speech
0266             end
0267         else
0268             if mval
0269                 procdesc=proc(x,fs,xx,ii,r);  % process the noisy speech
0270             else
0271                 procdesc=proc(x,fs,xx,r);  % process the noisy speech
0272             end
0273         end
0274     else
0275         if isempty(r)
0276             if mval
0277                 procdesc=proc(x,fs,ii);  % process the noisy speech
0278             else
0279                 procdesc=proc(x,fs);  % process the noisy speech
0280             end
0281         else
0282             if mval
0283                 y=proc(x,fs,ii,r);  % process the noisy speech
0284             else
0285                 y=proc(x,fs,r);  % process the noisy speech
0286             end
0287         end
0288     end
0289 else
0290     procdesc='';
0291 end
0292 
0293 % now initialize the output file
0294 
0295 if pf(29) || pf(30)   % o/O output info
0296     nw=fix(datevec(now));
0297     of=sprintf('psy%4d%02d%02d%02d%02d.txt',nw(1:5)); % filename includes date and time to nearest minute
0298     ofid=fopen(of,'wt');
0299     if ~ofid
0300         error('Cannot write to %s',of);
0301     end
0302     fprintf(ofid,'%% %s evaluation on %s\n',mfilename,datestr(now));
0303     fmfnm=[mfilename('fullpath') '.m'];
0304     dd=dir(fmfnm);
0305     fprintf(ofid,'%% %s = %d bytes = %s\n',fmfnm,dd.bytes,dd.date);
0306     fprintf(ofid,'V %d\n',2); % print file format version number
0307     fmfnm=which(func2str(proc));
0308     dd=dir(fmfnm);
0309     fprintf(ofid,'P %s = %d bytes = %s\n',fmfnm,dd.bytes,dd.date);
0310     if numel(procdesc)
0311         fprintf(ofid,'C %s\n',procdesc);
0312     end
0313     fprintf(ofid,'O %s\n',mode);
0314 end
0315 
0316 % now start testing
0317 
0318 disp(['Testing ' procdesc]);
0319 % now do the main loop
0320 mnt=zeros(2+2*unimode,zmodel,3,ntrial+1);
0321 vnt=zeros(3+unimode,zmodel,ntrial+1);
0322 mnt(:,:,:,1)=m;
0323 vnt(:,:,1)=v;
0324 i=0;
0325 imax=0;
0326 quitit=0;
0327 while ~quitit
0328     i=i+1;
0329     isp=min(1+floor(rand(1)*ntok),ntok); % select a token
0330     [s,fs]=readsph([dfile tok{isp,1}]); % get the speech token
0331     s=[zeros(pv(6)*round(fs/10),1); activlev(s(:),fs,'n')]; % preappend zeros and normalize speech level
0332     if pf(1) && ii<=pv(4)  % if process adds its own noise
0333         if isempty(r)
0334             if mval
0335                 y=proc(s,fs,xx,ii);  % process the noisy speech
0336             else
0337                 y=proc(s,fs,xx);  % process the noisy speech
0338             end
0339         else
0340             if mval
0341                 y=proc(s,fs,xx,ii,r);  % process the noisy speech
0342             else
0343                 y=proc(s,fs,xx,r);  % process the noisy speech
0344             end
0345         end
0346     else
0347         nn=randn(length(s),1);
0348         x=nn+s*10^(xx/20);   % create the data
0349         if ii<=pv(4)
0350             if isempty(r)
0351                 if mval
0352                     y=proc(x,fs,ii);  % process the noisy speech
0353                 else
0354                     y=proc(x,fs);  % process the noisy speech
0355                 end
0356             else
0357                 if mval
0358                     y=proc(x,fs,ii,r);  % process the noisy speech
0359                 else
0360                     y=proc(x,fs,r);  % process the noisy speech
0361                 end
0362             end
0363         else
0364             y=x;            % unprocessed for last model
0365         end
0366     end
0367     y=y(1+pv(7)*round(fs/10):end);   % remove junk from the start
0368     if pf(13)
0369         prg=sprintf(' %d',length(tok{isp,2}));
0370     else
0371         prg='';
0372     end
0373     if pf(14)
0374         prG=sprintf('SNR=%d dB, ',round(xx));
0375     else
0376         prG='';
0377     end
0378     if pf(35)
0379         prr=sprintf(', ''r'' to repeat');
0380     else
0381         prr='';
0382     end
0383     prompt=[prG 'enter' prg ' digits (''q'' to quit' prr '): '];
0384     ansr=-(var(y)>varthr);
0385     say=1;
0386     while ansr<0
0387         if say
0388             tdel=0;
0389             tic;
0390             soundsc(y,fs);      % *** probably shouldn't be ...sc
0391             say=0;
0392         end
0393         rv=input(prompt,'s');
0394         tdel=toc;
0395         if ~isempty(rv)
0396             if lower(rv(1))=='q'
0397                 quitit=1;
0398                 ansr=2;
0399             elseif lower(rv(1))=='r' && pf(35)
0400                 say=1;
0401             elseif lower(rv(1))=='s' && pf(37)   % save the token
0402                 ofn=input('File name: ','s');
0403                 if numel(ofn)
0404                 writewav(y,fs,ofn);
0405                 end
0406             elseif all(rv>='0') && all(rv<='9') && ( ~pf(13) || length(rv)==length(tok{isp,2}))
0407                 ansr=strcmp(rv,tok{isp,2});
0408             end
0409         end
0410     end
0411     quitit=quitit || i==ntrial;   % mark as quiting if we have done all the trials
0412     jj=ii;  % remember which model has just been updated
0413     xxold=xx; % and what the SNR was
0414     if ansr<2  % valid answer: update the pdfs
0415         if unimode
0416             [xx,ii,m,v]=psycestu(ii,xx,ansr);
0417         else
0418             [xx,ii,m,v]=psycest(ii,xx,ansr);
0419         end
0420         mnt(:,:,:,i+1)=m;
0421         vnt(:,:,i+1)=v;
0422         imax=i;
0423     end
0424     if pf(30) || quitit && pf(29)   % 'O/o': output
0425         if ansr>1
0426             rv=num2str(double(rv(1)));
0427         end
0428         % could add in token name and length
0429         fprintf(ofid,'M %d %d %.3g %s %s %d %.1f',i,ii,xxold,tok{isp,2},rv,ansr,tdel);
0430         fprintf(ofid,' %.3g',m(:,jj,:),v(:,jj));
0431         fprintf(ofid,'\n');
0432     end
0433     if pf(32)  % 'P': plot PDF: figures 1:m
0434         figure(jj);
0435         if unimode
0436             psycestu(jj);
0437         else
0438             psycest(jj);
0439         end
0440     elseif quitit && pf(31)   % 'p': plot PDF: figures 1:m
0441         for jj=1:zmodel
0442             figure(jj);
0443             if unimode
0444                 psycestu(jj);
0445             else
0446                 psycest(jj);
0447             end
0448         end
0449     end
0450     if pf(12) || quitit && pf(11)   % 'F/f': plot Psychometric function on figure 101
0451         figure(pv(12)+1);
0452         if unimode
0453             qqu.pk=m(1,jj,pv(10)); % peak position
0454             qqu.w=m(2,1,pv(10));        % peak width
0455             qqu.ll=m(3,1,pv(10));    % peak slope on low side
0456             qqu.lh=m(4,1,pv(10));    % peak slope on high side
0457             qqu.gu=pact(2);      % guess rate
0458             qqu.la=pact(1);      % lapse rate
0459             sw=qqu.w*qqu.ll*qqu.lh/(qqu.ll+qqu.lh);   % normalized distance of inflections from peak
0460             xax=linspace(qqu.pk-(4+sw)/qqu.ll,qqu.pk+(4+sw)/qqu.lh,200);
0461             bs=(qqu.lh-qqu.ll)/2;
0462             bu=(qqu.lh+qqu.ll)/2;
0463             plot(xax,qqu.gu+(1-qqu.gu-qqu.la)*(1+2*exp(-sw)*cosh(bs*(xax-qqu.pk)+bu*abs(xax-qqu.pk))+exp(-2*sw)).^(-1));
0464         else
0465             sd=(pact(1,:)-pact(3,:)).*(1-pact(2,:)-pact(1,:))./(m(2,:,pv(10)).*(1-pact(3,:)-pact(2,:)));
0466             md=m(1,:,pv(10))-sd.*log((pact(1,:)-pact(3,:))./(1-pact(2,:)-pact(1,:)));
0467             xax=linspace(min(md-3*sd),max(md+3*sd),100);
0468             for jj=1:zmodel
0469                 plot(xax,psychofunc('',[pact(1,jj);m(:,jj,pv(10)) ; pact(2:3,jj); qact(11)],xax));
0470                 hold on
0471             end
0472             hold off
0473         end
0474         axis([xax(1) xax(end) 0 1]);
0475         xlabel('SNR (dB)');
0476         ylabel('Recognition Probability');
0477         title(sprintf('Intelligibility: %s',procdesc));
0478     end
0479     if pf(10) || quitit && pf(9)   % 'E/e': plot evolving Psychometric function on figure 103
0480         figure(pv(12)+3);
0481         psyevo=zeros(ntrial+1,nxevo);   % space for evolving pdf
0482         if unimode
0483             qqu.pk=m(1,jj,pv(10)); % peak position
0484             qqu.w=m(2,1,pv(10));        % peak width
0485             qqu.ll=m(3,1,pv(10));    % peak slope on low side
0486             qqu.lh=m(4,1,pv(10));    % peak slope on high side
0487             qqu.gu=pact(2);      % guess rate
0488             qqu.la=pact(1);      % lapse rate
0489             sw=qqu.w*qqu.ll*qqu.lh/(qqu.ll+qqu.lh);   % normalized distance of inflections from peak
0490             xax=linspace(qqu.pk-(4+sw)/qqu.ll,qqu.pk+(4+sw)/qqu.lh,nxevo);
0491             for iet=1:imax+1
0492                 qqu.pk=mnt(1,1,pv(10),iet); % peak position
0493                 qqu.w=mnt(2,1,pv(10),iet);        % peak width
0494                 qqu.ll=mnt(3,1,pv(10),iet);    % peak slope on low side
0495                 qqu.lh=mnt(4,1,pv(10),iet);    % peak slope on high side
0496                 sw=qqu.w*qqu.ll*qqu.lh/(qqu.ll+qqu.lh);   % normalized distance of inflections from peak
0497                 bs=(qqu.lh-qqu.ll)/2;
0498                 bu=(qqu.lh+qqu.ll)/2;
0499                 psyevo(iet,:)=qqu.gu+(1-qqu.gu-qqu.la)*(1+2*exp(-sw)*cosh(bs*(xax-qqu.pk)+bu*abs(xax-qqu.pk))+exp(-2*sw)).^(-1);
0500             end
0501             imagesc(xax,0:ntrial,psyevo);
0502             axis 'ij'  % put trial 0 at the top
0503         else
0504         end
0505         xlabel('SNR (dB)');
0506         ylabel('After trial');
0507         title(sprintf('Intelligibility: %s',procdesc));
0508     end
0509     if pf(44) || quitit && pf(43)   % 'V/v': plot convergence on figure 102
0510         figure(pv(12)+2);
0511         if uniplot
0512             sw=mnt(2,1,pv(10),1:imax+1).*mnt(3,1,pv(10),1:imax+1).*mnt(4,1,pv(10),1:imax+1)./(mnt(3,1,pv(10),1:imax+1).*mnt(4,1,pv(10),1:imax+1));
0513             subplot(221)
0514             plot(0:imax,squeeze(mnt(1,1,pv(10),1:imax+1)));
0515             set(gca,'xlim',[0 ntrial]);
0516             xlabel('After trial');
0517             ylabel('Peak position (dB SNR)');
0518             subplot(222)
0519             plot(0:imax,squeeze(mnt(1,1,pv(10),1:imax+1)-sw.*mnt(3,1,pv(10),1:imax+1)),'-b',0:imax,squeeze(mnt(1,1,pv(10),1:imax+1)+sw.*mnt(4,1,pv(10),1:imax+1)),'-b');
0520             set(gca,'xlim',[0 ntrial]);
0521             xlabel('After trial');
0522             ylabel('Inflections (dB)');
0523             subplot(223)
0524             plot(0:imax,squeeze(mnt(3,1,pv(10),1:imax+1)));
0525             set(gca,'xlim',[0 ntrial]);
0526             xlabel('After trial');
0527             ylabel('Upwards slope (prob/dB)');
0528             subplot(224)
0529             plot(0:imax,squeeze(mnt(4,1,pv(10),1:imax+1)));
0530             set(gca,'xlim',[0 ntrial]);
0531             xlabel('After trial');
0532             ylabel('Downwards slope (prob/dB)');
0533         else
0534             subplot(211);
0535             for jj=1:zmodel
0536                 plot(0:imax,squeeze(mnt(1,jj,pv(10),1:imax+1)));
0537                 hold on
0538             end
0539             hold off
0540             set(gca,'xlim',[0 ntrial]);
0541             xlabel('After trial');
0542             ylabel('SRT (dB SNR)');
0543             subplot(212);
0544             for jj=1:zmodel
0545                 plot(0:i,squeeze(mnt(2,jj,pv(10),1:imax+1)));
0546                 hold on
0547             end
0548             hold off
0549             set(gca,'xlim',[0 ntrial]);
0550             xlabel('After trial');
0551             ylabel('Slope (Prob/dB)');
0552         end
0553     end
0554 end   % main loop for each probe value
0555 if pf(29) || pf(30)
0556     fclose(ofid);
0557 end

Generated on Thu 23-Feb-2012 09:25:48 by m2html © 2003