Mercurial > hg > aimmat
annotate aim-mat/tools/@signal/buildspikesfrompoints.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 % function sig=buildspikesfrompoints(sig,xx,yy) |
tomwalters@0 | 3 % calculates a @signal from the points in x and y |
tomwalters@0 | 4 % the new signal is zero everywhere except from the points in xx |
tomwalters@0 | 5 % |
tomwalters@0 | 6 % INPUT VALUES: |
tomwalters@0 | 7 % sig: original @signal |
tomwalters@0 | 8 % xx: x-values of points |
tomwalters@0 | 9 % yy: y-values of points |
tomwalters@0 | 10 % |
tomwalters@0 | 11 % RETURN VALUE: |
tomwalters@0 | 12 % sig: new @signal |
tomwalters@0 | 13 % |
bleeck@3 | 14 % This external file is included as part of the 'aim-mat' distribution package |
bleeck@3 | 15 % (c) 2011, University of Southampton |
bleeck@3 | 16 % Maintained by Stefan Bleeck (bleeck@gmail.com) |
bleeck@3 | 17 % download of current version is on the soundsoftware site: |
bleeck@3 | 18 % http://code.soundsoftware.ac.uk/projects/aimmat |
bleeck@3 | 19 % documentation and everything is on http://www.acousticscale.org |
tomwalters@0 | 20 |
tomwalters@0 | 21 function sig=buildspikesfrompoints(sig,xx,yy) |
tomwalters@0 | 22 % uage: sig=buildspikesfrompoints(sig,xx,yy) |
tomwalters@0 | 23 % makes a dot of the hight given in yy at each point given in xx |
tomwalters@0 | 24 % all other values =0 |
tomwalters@0 | 25 |
tomwalters@0 | 26 |
tomwalters@0 | 27 sig=mute(sig); |
tomwalters@0 | 28 |
tomwalters@0 | 29 nr_points=length(xx); |
tomwalters@0 | 30 for i=1:nr_points |
tomwalters@0 | 31 oldval=gettimevalue(sig,xx(i)); |
tomwalters@0 | 32 newval=oldval+yy(i); |
tomwalters@0 | 33 sig=addtimevalue(sig,xx(i),newval); |
tomwalters@0 | 34 end |
tomwalters@0 | 35 |
tomwalters@0 | 36 |