


Convert tidal ellipse parameters into amplitude and phase lag parameters. Its inverse is app2ep.m. Please refer to app2ep for the meaning of the inputs and outputs. Zhigang Xu Oct. 20, 2000 Document: tidal_ellipse.ps


0001 function [Au, PHIu, Av, PHIv, w, TWOCIR]=ep2ap(SEMA, ECC, INC, PHA, plot_demo) 0002 % 0003 % Convert tidal ellipse parameters into amplitude and phase lag parameters. 0004 % Its inverse is app2ep.m. Please refer to app2ep for the meaning of the 0005 % inputs and outputs. 0006 % 0007 % Zhigang Xu 0008 % Oct. 20, 2000 0009 % 0010 % Document: tidal_ellipse.ps 0011 % 0012 if nargin < 5 0013 plot_demo=0; % by default, no plot for the ellipse 0014 end 0015 0016 Wp = (1+ECC)/2 .*SEMA; 0017 Wm = (1-ECC)/2 .*SEMA; 0018 THETAp = INC-PHA; 0019 THETAm = INC+PHA; 0020 0021 %convert degrees into radians 0022 THETAp = THETAp/180*pi; 0023 THETAm = THETAm/180*pi; 0024 0025 %Calculate wp and wm. 0026 wp = Wp.*exp(i*THETAp); 0027 wm = Wm.*exp(i*THETAm); 0028 0029 if nargout >= 5 0030 ndot=36; 0031 dot = 2*pi/ndot; 0032 ot = [0:dot:2*pi-dot]; 0033 w = wp(:)*exp(i*ot)+wm(:)*exp(-i*ot); 0034 w=reshape(w, [size(wp) ndot]); 0035 end 0036 0037 % Calculate cAu, cAv --- complex amplitude of u and v 0038 cAu = wp+conj(wm); 0039 cAv = -i*(wp-conj(wm)); 0040 Au = abs(cAu); 0041 Av = abs(cAv); 0042 PHIu = -angle(cAu)*180/pi; 0043 PHIv = -angle(cAv)*180/pi; 0044 0045 % flip angles in the range of [-180 0) to the range of [180 360). 0046 id = PHIu < 0; PHIu(id) = PHIu(id) + 360; 0047 id = PHIv < 0; PHIv(id) = PHIv(id) + 360; 0048 0049 if any(plot_demo) 0050 plot_ell(SEMA,ECC,INC,PHA,plot_demo); 0051 end 0052 0053 if nargout == 6 0054 TWOCIR=struct('Wp', Wp, 'THETAp', THETAp, 'wp', ... 0055 wp, 'Wm', Wm, 'THETAm', THETAm, 'wm', wm, 'ot', ot, 'dot', dot); 0056 end 0057 0058 %Authorship Copyright: 0059 % 0060 % The author of this program retains the copyright of this program, while 0061 % you are welcome to use and distribute this program as long as you credit 0062 % the author properly and respect the program name itself. Particularly, 0063 % you are expected to retain the original author's name in this original 0064 % version of the program or any of its modified version that you might make. 0065 % You are also expected not to essentially change the name of the programs 0066 % except for adding possible extension for your own version you might create, 0067 % e.g. app2ep_xx is acceptable. Any suggestions are welcome and enjoy my 0068 % program(s)! 0069 % 0070 % 0071 %Author Info: 0072 %_______________________________________________________________________ 0073 % Zhigang Xu, Ph.D. 0074 % (pronounced as Tsi Gahng Hsu) 0075 % Research Scientist 0076 % Coastal Circulation 0077 % Bedford Institute of Oceanography 0078 % 1 Challenge Dr. 0079 % P.O. Box 1006 Phone (902) 426-2307 (o) 0080 % Dartmouth, Nova Scotia Fax (902) 426-7827 0081 % CANADA B2Y 4A2 email xuz@dfo-mpo.gc.ca 0082 %_______________________________________________________________________ 0083 % 0084 %Release Date: Nov. 2000 0085 0086