tomwalters@0: % constructor of class @signal tomwalters@0: % parent class: none tomwalters@0: % function sig=signal(length,samplerate,name,unit_x,unit_y,start_time) tomwalters@0: % INPUT VALUES: tomwalters@0: % length: length of signal in seconds [default 1] tomwalters@0: % samplerate: samplerate in Hz (points per seconds) [default: 1000] tomwalters@0: % name: display name of the signal (string) tomwalters@0: % unit_x: display unit on x-axis (string) tomwalters@0: % unit_y: display unit on y-axis (string) tomwalters@0: % start_time: virtual start time of the signal (default 0) tomwalters@0: % tomwalters@0: % RETURN VALUE: tomwalters@0: % @signal-object tomwalters@0: % tomwalters@0: % Valid constructor-calls: tomwalters@0: % 1: no or any number of arguments above tomwalters@0: % 2: signal(@other_signal_object) : Copy-Constructor tomwalters@0: % 3: signal(values): copies the values in the @signal tomwalters@0: % tomwalters@0: % a signal consist of n points according to its length*sr tomwalters@0: % the time "0" is not associated with a bin. the first bin is time sr, the tomwalters@0: % second 2*sr, etc the nth bin is the signal-duration 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 tomwalters@0: tomwalters@0: function sig=signal(laenge,samplerate,name,unit_x,unit_y,start_time) tomwalters@0: tomwalters@0: tomwalters@0: if nargin < 6 tomwalters@0: start_time=0; tomwalters@0: end tomwalters@0: if nargin < 5 tomwalters@0: unit_y='amplitude'; tomwalters@0: end tomwalters@0: if nargin < 4 tomwalters@0: unit_x='time (ms)'; tomwalters@0: end tomwalters@0: if nargin < 3 tomwalters@0: name='generic Signal'; tomwalters@0: end tomwalters@0: if nargin < 2 tomwalters@0: samplerate=1000; tomwalters@0: end tomwalters@0: if nargin < 1 tomwalters@0: laenge=1; tomwalters@0: end tomwalters@0: tomwalters@0: if isobject(laenge) tomwalters@0: sig.werte=laenge.werte; tomwalters@0: samplerate=laenge.samplerate; tomwalters@0: name=laenge.name; tomwalters@0: unit_x=laenge.unit_x; tomwalters@0: unit_y=laenge.unit_y; tomwalters@0: start_time=laenge.start_time; tomwalters@0: % sig.nr_x_ticks=laenge.nr_x_ticks; tomwalters@0: % sig.x_tick_labels=laenge.x_tick_labels; tomwalters@0: else tomwalters@0: a1=size(laenge,1); a2=size(laenge,2); tomwalters@0: if a1>1 & a2>1 tomwalters@0: disp('Signal Constructor Error: input vector has more than one dimension'); tomwalters@0: end tomwalters@0: % erst Abfrage, welche Konstruktionsmethode: tomwalters@0: if a2>1 %Benutzer hat Zeilenvektor eingegeben, wir wollen einen Spaltenvektor tomwalters@0: laenge=laenge'; tomwalters@0: a1=a2; tomwalters@0: end tomwalters@0: if a1>1 % AHA! Ein Vektor tomwalters@0: sig.werte=laenge; tomwalters@0: else tomwalters@0: nr_points=round(laenge*samplerate); tomwalters@0: sig.werte=zeros(nr_points,1); tomwalters@0: end tomwalters@0: end tomwalters@0: sig.samplerate=samplerate; tomwalters@0: sig.name=name; tomwalters@0: sig.unit_x=unit_x; tomwalters@0: sig.unit_y=unit_y; tomwalters@0: sig.start_time=start_time; tomwalters@0: sig.nr_x_ticks=9; tomwalters@0: % if the ticks shell be numbers or something else tomwalters@0: sig.x_tick_labels=[]; tomwalters@0: tomwalters@0: sig=class(sig,'signal');