tomwalters@0: % method of class @signal tomwalters@0: % tomwalters@0: % INPUT VALUES: tomwalters@0: % tomwalters@0: % RETURN VALUE: tomwalters@0: % tomwalters@0: % bleeck@3: % This external file is included as part of the 'aim-mat' distribution package bleeck@3: % (c) 2011, University of Southampton bleeck@3: % Maintained by Stefan Bleeck (bleeck@gmail.com) bleeck@3: % download of current version is on the soundsoftware site: bleeck@3: % http://code.soundsoftware.ac.uk/projects/aimmat bleeck@3: % documentation and everything is on http://www.acousticscale.org bleeck@3: tomwalters@0: tomwalters@0: function sig=mult(a,b,start_time,dauer) tomwalters@0: %wenn b ein Vektor ist, werden die Werte einfach multipliziert tomwalters@0: % wenn b eine Struct ist, dann werden sie adäquat multipliziert tomwalters@0: tomwalters@0: if(~isobject(a)) tomwalters@0: disp('error: only works on signals'); tomwalters@0: end tomwalters@0: if nargin < 4 tomwalters@0: if isobject(b) tomwalters@0: dauer=GetLength(b); tomwalters@0: end tomwalters@0: end tomwalters@0: if nargin < 3 tomwalters@0: start_time=0; tomwalters@0: end tomwalters@0: tomwalters@0: % wenn ein Spaltenvektor multipliziert werden soll tomwalters@0: if isnumeric(b) tomwalters@0: sr=getsr(a); tomwalters@0: nr=max(size(b)); tomwalters@0: if nr>1 tomwalters@0: temp=signal(b,sr); % erzeuge ein neues Signal aus den Werten tomwalters@0: sig=mult(a,temp,start_time,dauer); % und lasse dann die beiden Signale zusammenaddieren tomwalters@0: else tomwalters@0: if nargin <3 tomwalters@0: sig=a*b; % einfache Zahl tomwalters@0: else % with starttime and duration tomwalters@0: start=time2bin(a,start_time)+1; % +1, because a signal starts at the first bin tomwalters@0: stop=time2bin(a,start_time+dauer); tomwalters@0: sig=a; tomwalters@0: sig.werte(start:stop)=sig.werte(start:stop)*b; tomwalters@0: end tomwalters@0: end tomwalters@0: return; tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: % das resultierede Signal kann länger sein als die Ausgangssignale tomwalters@0: % erst feststellen, wie lang das nachher sein soll tomwalters@0: laenge1=getlength(a); tomwalters@0: laenge2=getlength(b); %so lang ist das zweite Signal tomwalters@0: sr1=getsr(a); tomwalters@0: sampletime=1/sr1; tomwalters@0: sr2=getsr(b); tomwalters@0: tomwalters@0: if laenge2