DynamicX_varying_model

PURPOSE ^

I have 'perturbed' the following function from WaveLab.

SYNOPSIS ^

function sig_mod = DynamicX_varying_model(Name,n);

DESCRIPTION ^

 I have 'perturbed' the following function from WaveLab.

 MakeSignal -- Make artificial signal
  Usage
    sig = MakeSignal(Name,n)
  Inputs
    Name   string: 'HeaviSine', 'Bumps', 'Blocks',
            'Doppler', 'Ramp', 'Cusp', 'Sing', 'HiSine',
            'LoSine', 'LinChirp', 'TwoChirp', 'QuadChirp',
            'MishMash', 'WernerSorrows' (Heisenberg),
            'Leopold' (Kronecker), 'Piece-Regular' (Piece-Wise Smooth),
         'Riemann','HypChirps','LinChirps', 'Chirps', 'Gabor'
         'sineoneoverx','Cusp2','SmoothCusp','Gaussian'
         'Piece-Polynomial' (Piece-Wise 3rd degree polynomial)
    n      desired signal length
  Outputs
    sig    1-d signal

  References
    Various articles of D.L. Donoho and I.M. Johnstone

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function sig_mod = DynamicX_varying_model(Name,n);
0002 
0003 % I have 'perturbed' the following function from WaveLab.
0004 %
0005 % MakeSignal -- Make artificial signal
0006 %  Usage
0007 %    sig = MakeSignal(Name,n)
0008 %  Inputs
0009 %    Name   string: 'HeaviSine', 'Bumps', 'Blocks',
0010 %            'Doppler', 'Ramp', 'Cusp', 'Sing', 'HiSine',
0011 %            'LoSine', 'LinChirp', 'TwoChirp', 'QuadChirp',
0012 %            'MishMash', 'WernerSorrows' (Heisenberg),
0013 %            'Leopold' (Kronecker), 'Piece-Regular' (Piece-Wise Smooth),
0014 %         'Riemann','HypChirps','LinChirps', 'Chirps', 'Gabor'
0015 %         'sineoneoverx','Cusp2','SmoothCusp','Gaussian'
0016 %         'Piece-Polynomial' (Piece-Wise 3rd degree polynomial)
0017 %    n      desired signal length
0018 %  Outputs
0019 %    sig    1-d signal
0020 %
0021 %  References
0022 %    Various articles of D.L. Donoho and I.M. Johnstone
0023 
0024 % N = 2048;
0025 %
0026 % HeaviSine = MakeSignal('HeaviSine',N);
0027 % Blocks    = MakeSignal('Blocks',N);
0028 % Doppler   = MakeSignal('Doppler',N);
0029 % Ramp      = MakeSignal('Ramp',N);
0030 % Piece_Polynomial = MakeSignal('Piece-Polynomial',N);
0031 %
0032 % name = 1;
0033 % switch name
0034 %     case 1
0035 %         Name = 'HeaviSine';
0036 %     case 2
0037 %         Name = 'Blocks';
0038 %     case 3
0039 %         Name = 'Doppler';
0040 %     case 4
0041 %         Name = 'Ramp';
0042 %     case 5
0043 %         Name = 'Piece-Polynomial';
0044 %     otherwise
0045 %         disp('hey ... ');
0046 % end
0047 
0048 N = n;
0049 sig = MakeSignal(Name,N);
0050 
0051 sig_old = sig;
0052 
0053 % modify the signal randomly while preserving the structure.
0054 t = (1:N)./N;
0055 if strcmp(Name,'HeaviSine'),
0056     signal = (1+randn*.05)*4.*sin(4*pi.*t*(1+randn*.02));
0057     signal = signal - sign(t - .3*(1+randn*.01)) - sign(.72*(1+randn*.01) - t);
0058 
0059 elseif strcmp(Name,'Doppler'),
0060     sig = sqrt(t.*(1-t)).*sin((2*pi*1.05) ./(t+.05));
0061     signal = (1+randn*.02)*sqrt(t.*(1-t)).*sin((2*pi*1.05*(1+randn*.02)) ./(t+.05*(1+randn*.02)));
0062 
0063 elseif strcmp(Name,'Ramp')
0064     sig = t - (t >= .37);
0065     signal = (1+randn*.05)*t - (t >= .37*(1+randn*.02));
0066 elseif strcmp (Name,'Blocks')
0067     pos = [ .1 .13 .15 .23 .25 .40 .44 .65  .76 .78 .81];
0068     hgt = [4 (-5) 3 (-4) 5 (-4.2) 2.1 4.3  (-3.1) 2.1 (-4.2)];
0069     sig = zeros(size(t));
0070     for j=1:length(pos)
0071         sig = sig + (1 + sign(t-pos(j))).*(hgt(j)/2) ;
0072     end
0073     signal = sig;
0074     for j=1:length(pos)-1
0075         rand_s = randn;
0076         wt = (1+rand_s*.1);
0077         wt = 1+randsrc*rand*.2;
0078         signal(ceil(pos(j)*N):floor(pos(j+1)*N)) =  signal(ceil(pos(j)*N):floor(pos(j+1)*N))*wt;
0079     end
0080 
0081 elseif strcmp(Name,'Piece-Polynomial'),
0082     n = N;
0083     t = (1:fix(n/5)) ./fix(n/5);
0084     sig1=20*(t.^3+t.^2+4)*(1+(randn*.1));
0085     sig3=40*(2.*t.^3+t)*(1+(randn*.1)) + 100*(1+(randn*.05));
0086     sig2=10.*t.^3*(1+(randn*.05)) + 45*(1+(randn*.1));
0087     sig4=16*t.^2+8.*t*(1+randn*.1)+16*(1+(randn*.05));
0088     sig5=20*(t+4)*(1+(randn*.1));
0089     sig6(1:fix(n/10))=ones(1,fix(n/10))*(1+(randn*.1));
0090     sig6=sig6*20*(1+(randn*.05));
0091     sig(1:fix(n/5))=sig1;
0092     sig(2*fix(n/5):-1:(fix(n/5)+1))=sig2;
0093     sig((2*fix(n/5)+1):3*fix(n/5))=sig3;
0094     sig((3*fix(n/5)+1):4*fix(n/5))=sig4;
0095     sig((4*fix(n/5)+1):5*fix(n/5))=sig5(fix(n/5):-1:1);
0096     diff=n-5*fix(n/5);
0097     sig(5*fix(n/5)+1:n)=sig(diff:-1:1);
0098     %sig((fix(n/20)+1):(fix(n/20)+fix(n/10)))=-ones(1,fix(n/10))*20;
0099     sig((fix(n/20)+1):(fix(n/20)+fix(n/10)))=ones(1,fix(n/10))*10;
0100     sig((n-fix(n/10)+1):(n+fix(n/20)-fix(n/10)))=ones(1,fix(n/20))*150;
0101     % zero-mean
0102     bias=sum(sig)/n;
0103     sig=sig-bias;
0104     signal = sig;
0105 end
0106 
0107 sig_mod = signal;
0108 
0109 % Originally made by David L. Donoho.
0110 % Function has been enhanced.
0111 
0112 %  Part of Wavelab Version 850
0113 %  Built Tue Jan  3 13:20:39 EST 2006
0114 %  This is Copyrighted Material
0115 %  For Copying permissions see COPYING.m
0116 %  Comments? e-mail wavelab@stat.stanford.edu

Generated on Mon 10-Jun-2013 23:03:23 by m2html © 2005