Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.mso.anu.edu.au/~fbriggs/WAARNEEM/optimal_smooth_demo.mac
Дата изменения: Thu Oct 4 12:53:58 2001
Дата индексирования: Tue Oct 2 06:01:06 2012
Кодировка:

Поисковые слова: messenger
demo 1
#
# USAGE: in sm (supermongo)
# : macro read gauss_test.sm <<= loads macro into sm
# : noisedemo 1000 <<= runs macro with 1000 pts
#
define N $1
set x=1,$N
# dummy call to get ws dimensioned right
get_hist x v ws -.5 .5 .02
set ws=ws*0
erase
window 1 1 1 1

set y=x*0
limits 0 $N -.7 0.7
box
ptype 1 1
# generate a lot of points to uniformly cover -0.5 to 0.5
# -and- at the same time do averages of 10 samples => pseudo-gaussian
do i=1,10 {
set t=random($N)-0.5
set y=y+t
# keep plotting the uniform points
points x t
get_hist t v w -.5 .5 .02
set ws=ws+w
}
echo * Uniformly Distributed between -0.5 and 0.5 *
toplabel * Uniformly Distributed between -0.5 and 0.5 *
# use call to "cursor" in order to pause
cursor
# prepare and plot the pseudo gaussian points
set y=y/10
lweight 3
ctype red
connect x y
ctype default
lweight 1
define ave (sum(y)/$N)
define rms (sqrt(sum(y*y)/$N))
define err ($rms/sqrt($N))
echo rms=sigma= $rms
echo average= $ave +- $err
echo
echo * red: averages of 10 random points *

print noise_file { y }

cursor

erase
ctype default
limits x y
box
connect x y
set s=abs(x-600)<50?.06:0
ctype red
cursor
lweight 3
connect x s
lweight 1
set ynew=y+s
ctype 0
cursor
erase
box
limits x ynew
erase
box
connect x ynew
stats ynew ave sig kur
echo ...
echo stats ynew ave sig kur
echo ave=$ave sigma=$sig
echo ...
echo vecminmax ynew mn mx
vecminmax ynew mn mx
echo min=$mn max=$mx
echo
cursor

smooth ynew ysmo 20
echo ******************* smooth ynew ysmo 20
ctype red
lweight 3
connect x ysmo
ctype 0
lweight 1

cursor
erase
box
connect x ysmo
stats ysmo ave sig kur
echo ...
echo stats ysmo ave sig kur
echo ave=$ave sigma=$sig
echo ...
echo vecminmax ysmo mn mx
vecminmax ysmo mn mx
echo min=$mn max=$mx max/sig=$($mx/$sig)
echo
cursor
ctype red
connect x s
ctype 0
cursor

limits x ynew
erase
box
connect x ynew

smooth ynew ysmo 50
echo ****************** smooth ynew ysmo 50
ctype red
lweight 3
connect x ysmo
ctype 0
lweight 1

cursor
erase
box
connect x ysmo
echo set region=ysmo if(x<500&&x>50)
set region=ysmo if(x<500&&x>50)
stats region ave sig kur
echo ...
echo stats region ave sig kur
echo ave=$ave sigma=$sig
echo ...
echo vecminmax ysmo mn mx
vecminmax ysmo mn mx
echo min=$mn max=$mx max/sig=$($mx/$sig)
echo
cursor
ctype red
connect x s
ctype 0
cursor




limits x ynew
erase
box
connect x ynew
cursor

smooth ynew ysmo 100
echo ********************* smooth ynew ysmo 100
ctype red
lweight 3
connect x ysmo
ctype 0
lweight 1

cursor
erase
box
connect x ysmo
echo set region=ysmo if(x<500&&x>50)
set region=ysmo if(x<500&&x>50)
stats region ave sig kur
echo ...
echo stats region ave sig kur
echo ave=$ave sigma=$sig
echo ...
echo vecminmax ysmo mn mx
vecminmax ysmo mn mx
echo min=$mn max=$mx max/sig=$($mx/$sig)
echo
cursor
ctype red
connect x s
ctype 0

cursor
limits x ynew
erase
box
connect x ynew
cursor

smooth ynew ysmo 200
echo ***************** smooth ynew ysmo 200
ctype red
lweight 3
connect x ysmo
ctype 0
lweight 1

cursor
erase
box
connect x ysmo
echo set region=ysmo if(x<500&&x>50)
set region=ysmo if(x<500&&x>50)
stats region ave sig kur
echo ...
echo stats region ave sig kur
echo ave=$ave sigma=$sig
echo ...
echo vecminmax ysmo mn mx
vecminmax ysmo mn mx
echo min=$mn max=$mx max/sig=$($mx/$sig)
echo
cursor
ctype red
connect x s
ctype 0