mirror of
https://github.com/eddyem/lectures.git
synced 2026-03-21 09:10:57 +03:00
add 03-pract
This commit is contained in:
38
Komp_obr_SFedU/Materials4Pract/03/2015_09_30_pf.tab
Normal file
38
Komp_obr_SFedU/Materials4Pract/03/2015_09_30_pf.tab
Normal file
@@ -0,0 +1,38 @@
|
||||
Date: Sun Aug 30 02:13:37 2015
|
||||
Focus: PF
|
||||
#
|
||||
# K0 K1 K2 K3 K4 K5 K6 K7
|
||||
# A0 L k F dS Z0 d d1
|
||||
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
#
|
||||
: Alpha Delta : dAlp dDel : dA dZ : A Z : Stime :
|
||||
|00:30:52.65 +53:40:12.1|+003.23 -079.0|+145.7 -080.1|-182.01 10.02|00:33:14|
|
||||
|00:32:04.58 +73:40:06.2|-000.63 -076.1|-008.8 -076.1|-180.52 30.01|00:35:46|
|
||||
|12:35:08.54 +86:20:53.5|+032.23 +077.1|-040.6 -076.7|-179.94 49.98|00:38:11|
|
||||
|12:38:12.10 +66:17:44.9|+008.12 +080.9|-052.6 -080.5|-179.73 70.01|00:40:46|
|
||||
|07:51:06.93 +45:45:49.8|-002.66 +090.0|-051.0 -081.2|-134.58 69.59|00:43:41|
|
||||
|06:05:33.51 +56:39:37.4|-007.78 +056.7|-039.4 -080.2|-134.83 49.70|00:46:03|
|
||||
|03:37:12.63 +58:36:39.2|-010.08 -010.9|-009.9 -079.4|-135.12 29.71|00:48:24|
|
||||
|01:32:34.55 +50:15:37.0|-004.94 -073.4|+159.0 -083.2|-136.94 09.62|00:51:26|
|
||||
|01:46:08.88 +42:52:51.0|-008.05 -014.0|+170.1 -085.2|-089.76 09.43|00:54:28|
|
||||
|03:28:32.99 +36:43:39.2|-006.02 +035.9|-002.6 -080.8|-089.56 29.50|00:56:53|
|
||||
|04:51:43.49 +26:07:38.8|-003.67 +071.6|-037.3 -082.2|-089.33 49.65|00:59:18|
|
||||
|06:00:16.58 +13:40:11.2|-002.14 +090.4|-049.6 -083.6|-089.56 69.49|01:01:52|
|
||||
|03:55:14.79 -14:05:23.0|-000.25 +098.3|-051.5 -085.7|-044.47 69.58|01:04:47|
|
||||
|03:16:12.86 +03:01:52.8|-001.18 +088.2|-038.6 -085.1|-044.36 49.62|01:07:14|
|
||||
|02:35:53.87 +20:01:23.9|-003.12 +072.5|-003.5 -084.8|-044.15 29.69|01:09:42|
|
||||
|01:44:26.98 +36:13:33.5|-006.39 +052.2|+184.9 -088.1|-041.82 09.57|01:12:49|
|
||||
|01:12:58.16 +33:40:55.7|-002.28 +087.6|+191.8 -085.9|+003.63 09.99|01:15:59|
|
||||
|01:15:51.16 +13:42:37.5|+000.04 +082.5|+001.6 -082.5|+001.34 29.94|01:18:35|
|
||||
|01:18:52.88 -06:26:11.3|+001.97 +082.5|-037.3 -082.8|+000.74 50.08|01:21:09|
|
||||
|23:15:10.36 +03:00:03.2|+004.54 +052.3|-040.3 -080.0|+045.74 50.29|01:29:07|
|
||||
|00:00:32.24 +20:03:29.1|+003.22 +064.7|-003.6 -079.0|+046.11 30.29|01:31:36|
|
||||
|00:56:31.33 +36:16:21.9|+002.54 +083.8|+182.1 -083.1|+047.81 10.36|01:34:34|
|
||||
|00:40:11.31 +42:45:58.2|+006.76 +045.7|+178.5 -081.3|+090.08 10.46|01:37:28|
|
||||
|23:03:17.60 +36:43:17.1|+005.69 +034.0|+002.5 -076.5|+090.40 30.39|01:39:52|
|
||||
|21:45:06.80 +26:22:15.9|+005.87 +023.6|-035.6 -077.7|+090.41 50.37|01:42:15|
|
||||
|20:41:00.09 +13:41:02.8|+006.33 +016.2|-052.6 -079.5|+090.52 70.47|01:44:54|
|
||||
|18:34:12.94 +45:46:46.2|+008.51 +017.0|-051.6 -076.5|+135.37 70.36|01:47:47|
|
||||
|20:26:11.28 +56:41:58.6|+009.79 +000.1|-038.7 -075.1|+135.17 50.26|01:50:11|
|
||||
|22:59:40.78 +58:39:16.2|+009.24 -015.8|-005.0 -074.0|+135.00 30.25|01:52:36|
|
||||
|01:08:27.11 +50:11:46.7|+008.50 -020.1|+167.4 -078.6|+133.37 10.33|01:55:28|
|
||||
93
Komp_obr_SFedU/Materials4Pract/03/getSKNcoeff.m
Normal file
93
Komp_obr_SFedU/Materials4Pract/03/getSKNcoeff.m
Normal file
@@ -0,0 +1,93 @@
|
||||
function SKN = getSKNcoeff(tabname, imprefix)
|
||||
%
|
||||
% SKN = getSKNcoeff(tabname)
|
||||
%
|
||||
% Calculate SKN coefficients & plot graphs
|
||||
%
|
||||
% parameters:
|
||||
% tabname - filename with table of dA/dZ
|
||||
%
|
||||
% SKN:
|
||||
% dA = K0 + K1/tg(Z) + K2/sin(Z) - K3*sin(A)/tg(Z) + K4 *cos(delta)*cos(P)/sin(Z)
|
||||
% dZ = K5 + K6*siz(Z) + K7*cos(Z) + K3*cos(A) + K4*cos(phi)*sin(A)
|
||||
%
|
||||
% K0 = A0 - azimuth zero; K1 = L - horiz axe inclination; K2 = k - collimation error;
|
||||
% K3 = F - lattitude error of vert. axe; K4 = dS - time error
|
||||
% K5 = Z0 - zenith zero; K6 = d - tube bend; K7 = d1 - cos. tube bend
|
||||
%
|
||||
% phi = 43.6535278 - lattitude
|
||||
% t = LST - Alpha - hour angle
|
||||
% P=atan(sin(t)/(tan(phi)*cos(Del)-sin(Del)*cos(t))) - parallax angle
|
||||
%
|
||||
if(nargin == 1) imprefix = ""; endif
|
||||
[Ald Alm Als Deld Delm Dels dAl_S dDel_S dA dZ A Z STh STm STs ] = ...
|
||||
textread(tabname, "|%f:%f:%f %f:%f:%f|%f %f|%f %f|%f %f|%f:%f:%f|", ...
|
||||
60, "headerlines", 8);
|
||||
A = A*pi/180; % all angles here will be in radians
|
||||
Z = Z*pi/180;
|
||||
Al = pi*(Ald+Alm/60+Als/3600)/180; % right accession
|
||||
Delsig = Deld./abs(Deld); % declination sign
|
||||
Del = pi*Delsig.*(abs(Deld)+Delm/60+Dels/3600)/180; % declination
|
||||
phi = 43.6535278 * pi / 180; % lattitude
|
||||
t = pi*(STh+STm/60+STs/3600)/12 - Al; % hour angle
|
||||
P = atan(sin(t)./(tan(phi).*cos(Del)-sin(Del).*cos(t))); % parallax angle
|
||||
cont = 1;
|
||||
while cont
|
||||
printf("\n\n\t\t\t\tIteration %d\n\n", cont);
|
||||
onescol = ones(size(dA)); % column with ones - for less square method
|
||||
cosZ = cos(Z);
|
||||
sinZ = sin(Z);
|
||||
cosA = cos(A);
|
||||
sinA = sin(A);
|
||||
tgZ = tan(Z);
|
||||
Xmatr = [onescol sinZ cosZ cosA cos(phi).*sinA];
|
||||
K = Xmatr \ dZ;
|
||||
K5 = K(1); K6 = K(2); K7 = K(3); K3 = K(4); K4 = K(5);
|
||||
dZSKN = K5 + K6*sinZ + K7*cosZ + K3*cosA + K4*cos(phi)*sinA; % dZ by SKN
|
||||
K4fr = cos(Del).*cos(P)./sinZ; % K4 multiplier
|
||||
dASKN34 = dA + K3*sinA./tgZ - K4*K4fr; % dA components fixed by K3 & K4
|
||||
Xmatr = [onescol 1./tgZ 1./sinZ];
|
||||
K = Xmatr \ dASKN34;
|
||||
K0 = K(1); K1 = K(2); K2 = K(3);
|
||||
SKN = [K0, K1, K2, K3, K4, K5, K6, K7];
|
||||
dASKN = K0 + K1./tgZ + K2./sinZ - K3*sinA./tgZ + K4*K4fr;
|
||||
ddA = dA - dASKN;
|
||||
ddZ = dZ - dZSKN;
|
||||
sddA = std(ddA); sddZ = std(ddZ);
|
||||
mddA = median(ddA); mddZ = median(ddZ);
|
||||
printf("sigma(dda) = %f, sigma(ddZ) = %f\n", sddA, sddZ);
|
||||
%printf("mean(dda) = %f, mean(ddZ) = %f\n", mean(ddA), mean(ddZ));
|
||||
printf("median(dda) = %f, median(ddZ) = %f\n", mddA, mddZ);
|
||||
surge = find(abs(ddA - mddA) > 2*sddA);
|
||||
ssz = size(surge,1);
|
||||
if(ssz != 0)
|
||||
printf("Surges: \n")
|
||||
for i = 1:ssz
|
||||
idx = surge(i);
|
||||
printf("%f (Z = %f, A = %f)\n", ddA(idx), Z(idx)*180/pi, A(idx)*180/pi);
|
||||
endfor
|
||||
Z(surge) = []; A(surge) = []; Al(surge) = []; Del(surge) = [];
|
||||
t(surge) = []; P(surge) = []; dZ(surge) = []; dA(surge) = [];
|
||||
++cont;
|
||||
else
|
||||
cont = 0;
|
||||
endif
|
||||
endwhile
|
||||
printf("SKN coefficients: K0..K7: %f, %f, %f, %f, %f, %f, %f, %f\n", ...
|
||||
K0, K1, K2, K3, K4, K5, K6, K7);
|
||||
fg = figure;
|
||||
plot(A*180/pi, [ddA ddZ], 'o');
|
||||
legend("ddA", "ddZ");
|
||||
xlabel("A, degr"); ylabel("Remaining error: real-model");
|
||||
plotgr(sprintf("%s_%s", imprefix, "diff_vs_A"), fg);
|
||||
fg = figure;
|
||||
plot(Z*180/pi, [ddA ddZ], 'o');
|
||||
legend("ddA", "ddZ");
|
||||
xlabel("Z, degr"); ylabel("Remaining error: real-model");
|
||||
plotgr(sprintf("%s_%s", imprefix, "diff_vs_Z"), fg);
|
||||
endfunction
|
||||
|
||||
function plotgr(nm, fg)
|
||||
print(fg, '-dpdf', sprintf("%s.pdf", nm));
|
||||
print(fg, '-dpng', sprintf("%s.png", nm));
|
||||
endfunction
|
||||
31
Komp_obr_SFedU/Materials4Pract/03/three_s.m
Normal file
31
Komp_obr_SFedU/Materials4Pract/03/three_s.m
Normal file
@@ -0,0 +1,31 @@
|
||||
% three_s.m
|
||||
% [ X sigma ] = three_s(x, n)
|
||||
% Производит отбор выборки x с соответствующими частотами n
|
||||
% при помощи критерия "трех сигм"
|
||||
% результат: среднее значение X и его среднеквадратичное отклонение, sigma
|
||||
|
||||
function [ X sigma ] = three_s(x, n)
|
||||
newx = []; % вспомогательный массив
|
||||
Data = [x ; n]; % совмещенный массив данных
|
||||
X = sum(x.*n)/sum(n); % среднее арифметическое
|
||||
sigma = sqrt(sum(n.*(x-X).^2)/sum(n)); % среднеквадратичное отклонение
|
||||
down = X-3*sigma; % нижняя граница доверительного интервала
|
||||
up = X+3*sigma; % верхняя граница -//-
|
||||
a = find(x < down); % a и b - массив координат, выходящих за границы
|
||||
b = find(x > up);
|
||||
while (length(a) > 0) || (length(b) > 0) % пока есть неверные значения
|
||||
Data = Data(:, find(Data(1, find(Data(1,:) >= down)) <= up)); % выбрасываем их
|
||||
x = Data(1,:);
|
||||
n = Data(2,:);
|
||||
X = sum(x.*n)/sum(n);
|
||||
for a = [1:length(n)]
|
||||
newx = [newx ones(1,n(a)).*x(a)];
|
||||
endfor
|
||||
X = median(newx);
|
||||
sigma = sqrt(sum(n.*(x-X).^2)/sum(n));
|
||||
down = X-3*sigma;
|
||||
up = X+3*sigma;
|
||||
a = find(x < down);
|
||||
b = find(x > up);
|
||||
endwhile
|
||||
endfunction
|
||||
Reference in New Issue
Block a user