Revision 495
(checked in by cbc, 12 years ago)
|
Initial import of Stark code.
|
Line | |
---|
1 |
function [ur,vr]=rot(u,v,theta) |
---|
2 |
%ROT Rotate vectors |
---|
3 |
% ROT rotates input vectors u,v by radian angle |
---|
4 |
% theta COUNTERCLOCKWISE, and returns the rotated |
---|
5 |
% vectors. |
---|
6 |
% |
---|
7 |
% Input: u,v - series to rotate |
---|
8 |
% theta - rotation angle (in radians) |
---|
9 |
% |
---|
10 |
% Output: ur,vr - rotated series |
---|
11 |
% |
---|
12 |
% Call as: [ur,vr]=rot(u,v,theta); |
---|
13 |
% |
---|
14 |
|
---|
15 |
% Find not NaN's in data |
---|
16 |
temp=[u(:) v(:)]; |
---|
17 |
idx=find(~isnan(sum(temp.'))); |
---|
18 |
|
---|
19 |
|
---|
20 |
|
---|
21 |
|
---|
22 |
% Complexify input series |
---|
23 |
w=u(:)+i*v(:); |
---|
24 |
|
---|
25 |
% Rotate vector |
---|
26 |
wr=w*exp(i*theta); |
---|
27 |
|
---|
28 |
% extract rotated ur,vr |
---|
29 |
ur=real(wr); |
---|
30 |
vr=imag(wr); |
---|
31 |
|
---|
32 |
% |
---|
33 |
% Brian O. Blanton |
---|
34 |
% Department of Marine Sciences |
---|
35 |
% Ocean Processes Numerical Modeling Laboratory |
---|
36 |
% 12-7 Venable Hall |
---|
37 |
% CB# 3300 |
---|
38 |
% University of North Carolina |
---|
39 |
% Chapel Hill, NC |
---|
40 |
% 27599-3300 |
---|
41 |
% |
---|
42 |
% 919-962-4466 |
---|
43 |
% blanton@marine.unc.edu |
---|
44 |
% |
---|
45 |
% Spring 1999 |
---|
46 |
% |
---|
47 |
|
---|