library("times") ; load library
length = 200 ; size of the data
t=1:length
greed = t/length ; greed on the interval [0,1]
vr = 0.3 ; variance of the white noise
;create a signal on the unit interval with
;two jump points at the 0.4 and 0.7
signal = 0.5.*greed.*(greed <= 0.4)+(0.4+0.2.*greed).*(greed>0.4)
signal = signal + 0.4.*(greed>0.7)
randomize(123456789012)
data = signal+ vr.*normal(length) ;add white noise to the signal
alpha = 4;
jm = jump(data,alpha)
; plot the data
; the observable data will be shown by the blue crosses
; red line corresponds to the signal
; magenta line shows the locations of the detected jumps
signal=t~signal
jm= t~jm
data = t~data
setmaskl(signal,t',4,1,0)
setmaskp(signal,0,0,1)
setmaskl(jm,t',5,1,2)
setmaskp(jm,0,0,1)
setmaskl(data,t',0,2,1)
setmaskp(data,1,11,8)
output = createdisplay(2,1)
show(output,1,1,data)
show(output,2,1,jm,signal)
setgopt(output,2,1,"title","signal and detected jumps")
setgopt(output,1,1,"title","noisy signal")