-
Notifications
You must be signed in to change notification settings - Fork 1
/
binmap5.m
60 lines (48 loc) · 1.21 KB
/
binmap5.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
function [b1m, b2m, b3m, b4m, b5m] = binmap5(b1, b2, b3, b4, b5, r, theta, ptch, roll, how)
%USAGE
%-----
%[b1m, b2m, b3m, b4m, b5m] = binmap5(b1, b2, b3, b4, b5, r, theta, ptch, roll, how)
%
% theta, ptch and roll in RADIANS.
%
%Interpolate beam-coordinate velocities to fixed horizontal planes based on tilt angles
%(pitch and roll).
Sth = sin(theta);
Cth = cos(theta);
Sph2 = sin(ptch);
Cph2 = cos(ptch);
Sph3 = sin(roll);
Cph3 = cos(roll);
ZJ = r.*Cth;
Z5 = r;
z00 = [0 0 -1]';
[nz, nt] = size(b1);
% b1 b2 b3 b4 b5
E = [-Sth +Sth 0 0 0;
0 0 -Sth +Sth 0;
-Cth -Cth -Cth -Cth -1];
Bo = cat(3, b1, b2, b3, b4, b5);
for i=1:5
Ei = E(:,i);
Boi = Bo(:,:,i); % z, t, bi.
bmi = Boi;
if i==5
Z = Z5;
else
Z = ZJ;
end
for k=1:nt
PR = [Cph3(k) 0 Sph3(k);
Sph2(k).*Sph3(k) Cph2(k) -Sph2(k).*Cph3(k);
-Sph3(k).*Cph2(k) Sph2(k) Cph2(k).*Cph3(k)];
zi = ((PR*Ei)'*z00).*r; % Actual bin height, dot product of tilt matrix with along-beam distance vector.
bmi(:,k) = interp1(zi, Boi(:,k), Z, how);
end
Bm(:,:,i) = bmi;
end
b1m = Bm(:,:,1);
b2m = Bm(:,:,2);
b3m = Bm(:,:,3);
b4m = Bm(:,:,4);
b5m = Bm(:,:,5);
end