Mercurial > hg > aimmat
annotate aim-mat/tools/@signal/buildfrompoints.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=buildfrompoints(sig,xx,yy) |
tomwalters@0 | 3 % calculates a @signal from the points in x and y |
tomwalters@0 | 4 % |
tomwalters@0 | 5 % INPUT VALUES: |
tomwalters@0 | 6 % sig: original @signal |
tomwalters@0 | 7 % xx: x-values of points |
tomwalters@0 | 8 % yy: y-values of points |
tomwalters@0 | 9 % |
tomwalters@0 | 10 % RETURN VALUE: |
tomwalters@0 | 11 % sig: new @signal |
tomwalters@0 | 12 % |
bleeck@3 | 13 % This external file is included as part of the 'aim-mat' distribution package |
bleeck@3 | 14 % (c) 2011, University of Southampton |
bleeck@3 | 15 % Maintained by Stefan Bleeck (bleeck@gmail.com) |
bleeck@3 | 16 % download of current version is on the soundsoftware site: |
bleeck@3 | 17 % http://code.soundsoftware.ac.uk/projects/aimmat |
bleeck@3 | 18 % documentation and everything is on http://www.acousticscale.org |
bleeck@3 | 19 |
tomwalters@0 | 20 |
tomwalters@0 | 21 function sig=buildfrompoints(sig,xx,yy) |
tomwalters@0 | 22 |
tomwalters@0 | 23 |
tomwalters@0 | 24 x1=1; |
tomwalters@0 | 25 y1=0; |
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 x2=round(time2bin(sig,xx(i))); |
tomwalters@0 | 32 y2=yy(i); |
tomwalters@0 | 33 |
tomwalters@0 | 34 line=linspace(y1,y2,x2-x1+1); |
tomwalters@0 | 35 sig=setvalues(sig,line,x1); |
tomwalters@0 | 36 |
tomwalters@0 | 37 x1=x2+1; |
tomwalters@0 | 38 y1=y2; |
tomwalters@0 | 39 |
tomwalters@0 | 40 end |
tomwalters@0 | 41 |
tomwalters@0 | 42 |