function WMKSGNAL, Name,n ;+ ; NAME: ; WMKSGNAL ; ; PURPOSE: ; This function generates an artificial signal. ; ; CATEGORY: ; Wavelets ; ; CALLING SEQUENCE: ; sig = WMKSGNAL(Name,n) ; ; INPUTS: ; Name: string, 'HeaviSine', 'Bumps', 'Blocks' ; 'Doppler', 'Ramp', 'Cusp', 'Sing', 'HiSine', ; 'LoSine', 'LinChirp', 'TwoChirp', 'QuadChirp' ; 'MishMash' ; n: desired signal length ; ; OUTPUTS: ; sig: 1-d signal ; ; EXAMPLE: ; ; REFERENCES: ; various articles of D.L. Donoho and I.M. Johnstone ; ; MODIFICATION HISTORY: ; Written by: Amara Graps August, 1995 ;Translated from MatLab Wavelab routine: makesignal.m ;- Checkname = STRCOMPRESS(Name,/remove_all) ;remove white space Checkname = STRUPCASE(Checkname) ;make upper case t=WMKIARRY(1,1,n)+1 ;want values to start at 1 t = t/FLOAT(n) CASE Checkname OF 'HEAVISINE': BEGIN sig = 4*SIN(4*!pi*t) sig = sig - WSIGN(t - 0.3) - WSIGN(0.72 - t) END ;'HEAVISINE' 'BUMPS': BEGIN pos = [0.1,0.13,0.15,0.23,0.25,0.40,0.44,0.65,0.76,0.78,0.81] hgt = [4,5,3,4,5,4.2,2.1,4.3,3.1,5.1,4.2] wth = [0.005,0.005,0.006,0.01,0.01,0.03,0.01,0.01,0.005,0.008,0.005] sig = FLTARR(N_ELEMENTS(t)) FOR j =0, N_ELEMENTS(pos)-1 DO BEGIN sig = sig + hgt(j)/( 1 + ABS((t - pos(j))/wth(j)))^4 END ;FOR END ;'BUMPS' 'BLOCKS': BEGIN pos = [0.1,0.13,0.15,0.23,0.25,0.40,0.44,0.65,0.76,0.78,0.81] hgt = [4, (-5), 3, (-4), 5, (-4.2), 2.1, 4.3, (-3.1), 2.1, (-4.2)] sig = FLTARR(N_ELEMENTS(t)) FOR j=0, N_ELEMENTS(pos)-1 DO BEGIN sig = sig + (1 + WSIGN(t-pos(j)))*(hgt(j)/2) END ;for END ;'BLOCKS' 'DOPPLER': BEGIN sig = SQRT(t*(1-t))*sin((2*!pi*1.05) /(t+0.05)) END ;'DOPPLER' 'RAMP': BEGIN sig = t - (t GE 0.37) END ;'RAMP' 'CUSP': BEGIN sig = SQRT(ABS(t - 0.37)) END ;'CUSP' 'SING': BEGIN k = FLOOR(n * 0.37) sig = 1 /ABS(t - (k+.5)/FLOAT(n)) END ;'SING' 'HISINE': BEGIN sig = SIN( !pi * (n * 0.6902) * t) END ;'HISINE' 'LOSINE': BEGIN sig = SIN( !pi * (n * 0.3333) * t) END ;'LOSINE' 'LINCHIRP': BEGIN sig = SIN(!pi * t * ((n * 0.125) * t)) END ;'LINCHIRP' 'TWOCHIRP': BEGIN sig = SIN(!pi * t * (n * t)) + SIN((!pi/3.0) * t * (n * t)) END ;'TWOCHIRP' 'QUADCHIRP': BEGIN sig = SIN( (!pi/3.0) * t * (n * t^2)) END ;'QUADCHIRP' 'MISHMASH': BEGIN ; QuadChirp + LinChirp + HiSine sig = SIN( (!pi/3.0) * t * (n * t^2)) sig = sig + SIN( !pi * (n * 0.6902) * t) sig = sig + SIN(!pi * t * ((n * 0.125) * t)) END ;'MISHMASH' 'WERNERSORROWS': BEGIN sig = sin( !pi * t * (n/2.0 * t^2)) sig = sig + sin( !pi * (n * .6902) * t) sig = sig + sin(!pi * t * (n * t)) pos = [0.1,0.13,0.15,0.23,0.25,0.40,0.44,0.65,0.76,0.78,0.81] hgt = [4,5,3,4,5,4.2,2.1,4.3,3.1,5.1,4.2] wth = [0.005,0.005,0.006,0.01,0.01,0.03,0.01,0.01,0.005,0.008,0.005] FOR j =0, N_ELEMENTS(pos)-1 DO BEGIN sig = sig + hgt(j)/( 1 + ABS((t - pos(j))/wth(j)))^4 END ;FOR END ;'WERNERSORROWS' 'LEOPOLD': BEGIN sig = (t EQ FLOOR(0.37 * n)/FLOAT(n)) END ;'LEOPOLD' ELSE: BEGIN PRINT, 'I do not recognize this signal!' PRINT, 'Allowable Names are:' PRINT, 'HeaviSine' PRINT, 'Bumps' PRINT, 'Blocks' PRINT, 'Doppler' PRINT, 'Ramp' PRINT, 'Cusp' PRINT, 'Sing' PRINT, 'HiSine' PRINT, 'LoSine' PRINT, 'LinChirp' PRINT, 'TwoChirp' PRINT, 'QuadChirp' PRINT, 'MishMash' END ;ELSE ENDCASE ; ; Algorithm Source: WaveLab Version 0.600 ; WaveLab WWW site: http://playfair.stanford.edu/ ; WaveLab Questions? e-mail wavelab@playfair.stanford.edu ; RETURN, sig END ;***************************************************