48 |
|
die "Invalid input data, requires 5 columns\n" if ( $? ); |
49 |
|
open (MYFH, ">> $funcfile"); |
50 |
|
print MYFH "DEG : PI/180;\n"; |
51 |
< |
print MYFH "and(a,b) : if(a,b,a);\n"; |
51 |
> |
print MYFH "sq(x) : x*x;\n"; |
52 |
|
print MYFH "eq(a,b) : min(a-b+1e-5,b-a+1e-5);\n"; |
53 |
|
print MYFH "rtheta(i) : select(i,5,15,25,35,45,55,65,75,90);\n"; |
54 |
|
print MYFH "nphis(i) : select(i,1,8,16,20,24,24,24,16,12);\n"; |
55 |
|
print MYFH "tdeg1(tb) : if(tb-1.5, (rtheta(tb)+rtheta(tb-1))/2, 0);\n"; |
56 |
< |
print MYFH "omega1(tb) : 2*PI*if(tb-1.5, (cos(rtheta(tb-1)*DEG)-cos(rtheta(tb)*DEG))/nphis(tb),"; |
57 |
< |
print MYFH "\t(1 - cos(rtheta(1)*DEG)));\n"; |
56 |
> |
print MYFH "omega1(tb) : PI*if(tb-1.5, (sq(cos(rtheta(tb-1)*DEG))-sq(cos(rtheta(tb)*DEG)))/nphis(tb),"; |
57 |
> |
print MYFH "\t(1 - sq(cos(rtheta(1)*DEG))));\n"; |
58 |
|
print MYFH "tbin(b,cnt) : if(nphis(b)-cnt-.5, b, tbin(b+1,cnt-nphis(b)));\n"; |
59 |
|
print MYFH "tdeg(b) : tdeg1(tbin(1,b-1));\n"; |
60 |
|
print MYFH "omega(b) : omega1(tbin(1,b-1));\n"; |
65 |
|
if ($windoz) { |
66 |
|
$cmd = qq{cnt $nsamps } . |
67 |
|
qq{| rcalc -f $funcfile -w -e "tdeg=180/$nsamps*(\$1+.5);abs(x):if(x,x,-x)" } . |
68 |
< |
qq{-e "theta=tdeg*DEG;ifact=2*PI*abs(cos(theta))*sin(theta)" } . |
68 |
> |
qq{-e "theta=tdeg*DEG;ifact=PI*PI*abs(cos(theta))*sin(theta)" } . |
69 |
|
q{-e "$1=ifact*Tdiff(tdeg);$2=ifact*Rdiff(tdeg)" } . |
70 |
|
qq{| total -$hsamps -m}; |
71 |
|
} else { |
72 |
|
$cmd = qq{cnt $nsamps } . |
73 |
|
qq{| rcalc -f $funcfile -w -e 'tdeg=180/$nsamps*(\$1+.5);abs(x):if(x,x,-x)' } . |
74 |
< |
qq{-e 'theta=tdeg*DEG;ifact=2*PI*abs(cos(theta))*sin(theta)' } . |
74 |
> |
qq{-e 'theta=tdeg*DEG;ifact=PI*PI*abs(cos(theta))*sin(theta)' } . |
75 |
|
q{-e '$1=ifact*Tdiff(tdeg);$2=ifact*Rdiff(tdeg)' -od } . |
76 |
|
qq{| total -id2 -$hsamps -m}; |
77 |
|
} |