view aim-mat/tools/@signal/gen_complex_damp.m @ 0:74dedb26614d

Initial checkin of AIM-MAT version 1.5 (6.4.2011).
author tomwalters
date Fri, 20 May 2011 12:32:31 +0100
parents
children 20ada0af3d7d
line wrap: on
line source
% tool
%
%   INPUT VALUES:
%
%   RETURN VALUE:
%
%
% (c) 2003, University of Cambridge, Medical Research Council
% Stefan Bleeck (stefan@bleeck.de)
% http://www.mrc-cbu.cam.ac.uk/cnbh/aimmanual
% $Date: 2003/01/17 16:57:44 $
% $Revision: 1.3 $

function sig=gen_complex_damp(orgsig,carriers,halflifes,reprate,amplitudes)

% each combination possible
grafix=1;

for j=1:length(carriers)
    save_sigs(j)=generatedampsinus(orgsig,carriers(j),reprate(j),amplitudes(j),halflifes(j));
    
    if j==1
        gsig=save_sigs(j);
    else
        gsig=gsig+save_sigs(j);
    end
end

% savewave(tsig,'tsig');

sig=gsig;



if grafix
    plot_w=150;
    figure(1)
    clf
    subplot(3,1,[1,2])
    hold on
    nrc=length(carriers);
    
    % calculate where on the y-axis we are
    minf=100;
    maxf=5000;
    
    
    for i=1:nrc
        f=carriers(i);
        offx=f2f(f,minf,maxf,0,10,'loglin');
        plot(save_sigs(i)+offx);
    end
    set(gca,'xlim',[0 plot_w])
    set(gca,'ylim',[0 10])
    
    yt=[0.1 0.2 0.5 1 2 4]*1000;
    yt2=f2f(yt,minf,maxf,0,10,'loglin');
    set(gca,'ytick',yt2)
    set(gca,'yticklabel',yt)
    xlabel('')
    ylabel('frequency')
    title('part signals')
    subplot(3,1,3)
    plot(sig);
    set(gca,'xlim',[0 plot_w])
    title('total signal')

end