annotate aim-mat/tools/@signal/logsigx.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 % method of class @signal
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 % This external file is included as part of the 'aim-mat' distribution package
bleeck@3 9 % (c) 2011, University of Southampton
bleeck@3 10 % Maintained by Stefan Bleeck (bleeck@gmail.com)
bleeck@3 11 % download of current version is on the soundsoftware site:
bleeck@3 12 % http://code.soundsoftware.ac.uk/projects/aimmat
bleeck@3 13 % documentation and everything is on http://www.acousticscale.org
bleeck@3 14
tomwalters@0 15
tomwalters@0 16 function [lsig,scaleinfo]=logsigx(sig,tmin,tmax,nr_points)
tomwalters@0 17 % usage: [lsig,scaler]=logsigx(sig,tmin,tmax,nr_points)
tomwalters@0 18 % transferes the signal to a signal that is in logarithmic scale
tomwalters@0 19 % so plotting the original signal logarithmic is identical to
tomwalters@0 20 % plot the transfered signal linear
tomwalters@0 21 % uses only the part of the signal between tmin and tmax
tomwalters@0 22 %
tomwalters@0 23 % reverse operation: linsigx(sig,tmin,tmax,nr_points)
tomwalters@0 24
tomwalters@0 25
tomwalters@0 26 if nargin < 4
tomwalters@0 27 nr_points=getnrpoints(sig);
tomwalters@0 28 end
tomwalters@0 29 if nargin<3
tomwalters@0 30 tmax=getmaximumtime(sig);
tomwalters@0 31 end
tomwalters@0 32 if nargin<2
tomwalters@0 33 tmin=getminimumtime(sig);
tomwalters@0 34 end
tomwalters@0 35 if tmin==0
tomwalters@0 36 tmin=1/getsr(sig);
tomwalters@0 37 end
tomwalters@0 38
tomwalters@0 39
tomwalters@0 40 oldvals=getvalues(sig);
tomwalters@0 41 newvals=zeros(nr_points,1);
tomwalters@0 42
tomwalters@0 43
tomwalters@0 44 [ntimes,scaleinfo]=distributelogarithmic(tmin,tmax,nr_points);
tomwalters@0 45 newvals=gettimevalue(sig,ntimes);
tomwalters@0 46 if isnan(newvals(1))
tomwalters@0 47 newvals(1)=0;
tomwalters@0 48 end
tomwalters@0 49
tomwalters@0 50 lsig=sig; % copy all values
tomwalters@0 51 lsig=setvalues(lsig,newvals,1);
tomwalters@0 52
tomwalters@0 53 lsig=setnrxticks(lsig,6);
tomwalters@0 54 l=distributelogarithmic(tmin,tmax,6);
tomwalters@0 55
tomwalters@0 56 l=round(l*10000)/10;
tomwalters@0 57
tomwalters@0 58 lsig=setxlabels(lsig,l);
tomwalters@0 59