1 |
afe |
1.1 |
function [thetav,rhov] = cart2cyluv(u,v,thetai,rhoi,varargin) |
2 |
|
|
% z=cart2cyl(c,xi,yi); |
3 |
|
|
% |
4 |
|
|
|
5 |
|
|
NN=size(u); |
6 |
|
|
[x y nz]=size(u); |
7 |
|
|
stepx=(x+1)/(x); |
8 |
|
|
stepy=(y+1)/(y); |
9 |
|
|
[Y,X] = meshgrid(-(x)/2:stepx:(x)/2,-(y)/2:stepy:(y)/2); |
10 |
|
|
[theta,rho] = cart2pol(X,Y); |
11 |
|
|
|
12 |
afe |
1.2 |
|
13 |
|
|
% switches to increasing c-clockwise instead of clockwise |
14 |
|
|
theta=-theta; |
15 |
|
|
|
16 |
|
|
%original |
17 |
|
|
%azimv=u.*cos(theta)+v.*-sin(theta); |
18 |
|
|
%radialv=u.*sin(theta)+v.*cos(theta); |
19 |
|
|
|
20 |
|
|
% 2nd try |
21 |
|
|
%azimv=u.*cos(theta)+v.*sin(theta); |
22 |
|
|
%radialv=u.*sin(theta)+v.*-cos(theta); |
23 |
|
|
|
24 |
|
|
%azimv=u.*-cos(theta); %good |
25 |
|
|
%radialv=u.*-sin(theta);%good |
26 |
|
|
|
27 |
|
|
%azimv=v.*-sin(theta); % good |
28 |
|
|
%radialv=v.*cos(theta); % good |
29 |
|
|
|
30 |
|
|
% 3rd's the charm |
31 |
|
|
azimv=u.*-cos(theta)+v.*-sin(theta); |
32 |
|
|
radialv=u.*-sin(theta)+v.*cos(theta); |
33 |
afe |
1.1 |
|
34 |
|
|
theta=(theta./(pi*2)+0.5).*(size(thetai,2)); |
35 |
|
|
rho=max(rhoi)*rho/((x)/2); |
36 |
|
|
ntheta=x;nrho=y; |
37 |
|
|
|
38 |
|
|
THETA=reshape(theta,[1 ntheta*nrho]); |
39 |
|
|
RHO=reshape(rho,[1 ntheta*nrho]); |
40 |
|
|
del=griddata_preprocess(RHO,THETA,rhoi,thetai',varargin{:}); |
41 |
|
|
|
42 |
|
|
for k=1:nz; |
43 |
|
|
THETAV=reshape(azimv(:,:,k),[1 ntheta*nrho]); |
44 |
|
|
RHOV=reshape(radialv(:,:,k),[1 ntheta*nrho]); |
45 |
|
|
thetav(:,:,k)=griddata(RHO,THETA,THETAV,rhoi,thetai',varargin{:}); |
46 |
|
|
rhov(:,:,k)=griddata(RHO,THETA,RHOV,rhoi,thetai',varargin{:}); |
47 |
|
|
end % k |
48 |
|
|
|
49 |
|
|
% Split vertical and time dimensions |
50 |
|
|
if size(NN,2)>2 |
51 |
|
|
thetav=reshape(thetav,[size(thetav,1) size(thetav,2) NN(3:end)]); |
52 |
|
|
rhov=reshape(rhov,[size(rhov,1) size(rhov,2) NN(3:end)]); |
53 |
|
|
end |