annotate aim-mat/modules/usermodule/dualprofile/displaydualprofile.m @ 4:537f939baef0 tip

various bug fixes and changed copyright message
author Stefan Bleeck <bleeck@gmail.com>
date Tue, 16 Aug 2011 14:37:17 +0100
parents 20ada0af3d7d
children
rev   line source
tomwalters@0 1 % generating function for 'aim-mat'
tomwalters@0 2 %
tomwalters@0 3 % INPUT VALUES:
tomwalters@0 4 %
tomwalters@0 5 % RETURN VALUE:
tomwalters@0 6 %
tomwalters@0 7 %
bleeck@3 8 % (c) 2011, University of Southampton
bleeck@3 9 % Maintained by Stefan Bleeck (bleeck@gmail.com)
bleeck@3 10 % download of current version is on the soundsoftware site:
bleeck@3 11 % http://code.soundsoftware.ac.uk/projects/aimmat
bleeck@3 12 % documentation and everything is on http://www.acousticscale.org
bleeck@3 13
tomwalters@0 14
tomwalters@0 15 function displaydualprofile(sai,options,frame_number,ax)
tomwalters@0 16 if nargin<4
tomwalters@0 17 ax=gca;
tomwalters@0 18 end
tomwalters@0 19
tomwalters@0 20
tomwalters@0 21 % Test if the frame_number is available
tomwalters@0 22 if length(sai)<frame_number
tomwalters@0 23 % no its not
tomwalters@0 24 return
tomwalters@0 25 end
tomwalters@0 26 if ~(isfield(sai{frame_number}, 'interval_sum') & isfield(sai{frame_number}, 'frequency_sum'))
tomwalters@0 27 return
tomwalters@0 28 end
tomwalters@0 29
tomwalters@0 30 % ?????? per Definition ????
tomwalters@0 31 minimum_time_interval=options.minimum_time_interval; % in ms
tomwalters@0 32 maximum_time_interval=options.maximum_time_interval;
tomwalters@0 33 nr_labels = options.nr_labels;
tomwalters@0 34
tomwalters@0 35 % Normalize the profiles
tomwalters@0 36 fq_sum = sai{frame_number}.frequency_sum;
tomwalters@0 37 int_sum = sai{frame_number}.interval_sum;
tomwalters@0 38 if (getnrpoints(fq_sum)~=0)
tomwalters@0 39 int_sum = int_sum/getnrpoints(fq_sum);
tomwalters@0 40 end
tomwalters@0 41 if (getnrpoints(int_sum)~=0)
tomwalters@0 42 fq_sum = (fq_sum/getnrpoints(int_sum))*options.scalefactor*1.7;
tomwalters@0 43 end
tomwalters@0 44
tomwalters@0 45 cla;
tomwalters@0 46 %Plot both profiles into one figure
tomwalters@0 47 % frequency profile
tomwalters@0 48 fqp = getvalues(fq_sum)';
tomwalters@0 49 plot(ax,sai{frame_number}.channel_center_fq, fqp,'r');
tomwalters@0 50 hold on
tomwalters@0 51
tomwalters@0 52 % time interval profile
tomwalters@0 53 tip=getvalues(int_sum);
tomwalters@0 54 tip_x = bin2time(sai{frame_number}.interval_sum, 1:length(tip)); % Get the times
tomwalters@0 55 tip_x = tip_x((tip_x>=(minimum_time_interval/1000)) & tip_x<=(maximum_time_interval/1000));
tomwalters@0 56 tip = tip(time2bin(sai{frame_number}.interval_sum,tip_x(1)):time2bin(sai{frame_number}.interval_sum,tip_x(end)));
tomwalters@0 57 % tip_x is in ms. Change to Hz
tomwalters@0 58 tip_x = 1./tip_x;
tomwalters@0 59 plot(tip_x, tip, 'b');
tomwalters@0 60 set(ax,'XScale','log');
tomwalters@0 61
tomwalters@0 62 % Now lable it !
tomwalters@0 63 xlabel('Frequency [Hz]');
tomwalters@0 64 set(ax, 'YAxisLocation','right');
tomwalters@0 65 ti=50*power(2,[0:nr_labels]);
tomwalters@0 66 set(ax,'XTick', ti);
tomwalters@0 67 set(ax, 'XLim',[1000/maximum_time_interval sai{frame_number}.channel_center_fq(end)])
tomwalters@0 68 set(options.handles.checkbox6, 'Value',0);
tomwalters@0 69 set(options.handles.checkbox7, 'Value',0);
tomwalters@0 70 hold off
tomwalters@0 71
tomwalters@0 72
tomwalters@0 73 return