annotate aim-mat/tools/@signal/gen_complex_damp.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 % tool
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
tomwalters@0 14
tomwalters@0 15 function sig=gen_complex_damp(orgsig,carriers,halflifes,reprate,amplitudes)
tomwalters@0 16
tomwalters@0 17 % each combination possible
tomwalters@0 18 grafix=1;
tomwalters@0 19
tomwalters@0 20 for j=1:length(carriers)
tomwalters@0 21 save_sigs(j)=generatedampsinus(orgsig,carriers(j),reprate(j),amplitudes(j),halflifes(j));
tomwalters@0 22
tomwalters@0 23 if j==1
tomwalters@0 24 gsig=save_sigs(j);
tomwalters@0 25 else
tomwalters@0 26 gsig=gsig+save_sigs(j);
tomwalters@0 27 end
tomwalters@0 28 end
tomwalters@0 29
tomwalters@0 30 % savewave(tsig,'tsig');
tomwalters@0 31
tomwalters@0 32 sig=gsig;
tomwalters@0 33
tomwalters@0 34
tomwalters@0 35
tomwalters@0 36 if grafix
tomwalters@0 37 plot_w=150;
tomwalters@0 38 figure(1)
tomwalters@0 39 clf
tomwalters@0 40 subplot(3,1,[1,2])
tomwalters@0 41 hold on
tomwalters@0 42 nrc=length(carriers);
tomwalters@0 43
tomwalters@0 44 % calculate where on the y-axis we are
tomwalters@0 45 minf=100;
tomwalters@0 46 maxf=5000;
tomwalters@0 47
tomwalters@0 48
tomwalters@0 49 for i=1:nrc
tomwalters@0 50 f=carriers(i);
tomwalters@0 51 offx=f2f(f,minf,maxf,0,10,'loglin');
tomwalters@0 52 plot(save_sigs(i)+offx);
tomwalters@0 53 end
tomwalters@0 54 set(gca,'xlim',[0 plot_w])
tomwalters@0 55 set(gca,'ylim',[0 10])
tomwalters@0 56
tomwalters@0 57 yt=[0.1 0.2 0.5 1 2 4]*1000;
tomwalters@0 58 yt2=f2f(yt,minf,maxf,0,10,'loglin');
tomwalters@0 59 set(gca,'ytick',yt2)
tomwalters@0 60 set(gca,'yticklabel',yt)
tomwalters@0 61 xlabel('')
tomwalters@0 62 ylabel('frequency')
tomwalters@0 63 title('part signals')
tomwalters@0 64 subplot(3,1,3)
tomwalters@0 65 plot(sig);
tomwalters@0 66 set(gca,'xlim',[0 plot_w])
tomwalters@0 67 title('total signal')
tomwalters@0 68
tomwalters@0 69 end