


demonstrate how to use ap2ep and ep2ap


0001 %demonstrate how to use ap2ep and ep2ap 0002 % 0003 Au=rand(4,3,2); % so 4x3x2 multi-dimensional matrices are used for the 0004 Av=rand(4,3,2); % demonstration. 0005 Phi_v=rand(4,3,2)*360; % phase lags inputs are expected to be in degrees. 0006 Phi_u=rand(4,3,2)*360; 0007 0008 figure(1) 0009 clf 0010 [SEMA ECC INC PHA w]=ap2ep(Au, Phi_u, Av, Phi_v, [2 3 1]); 0011 figure(2) 0012 clf 0013 [rAu rPhi_u rAv rPhi_v rw]=ep2ap(SEMA, ECC, INC, PHA, [2 3 1]); 0014 0015 %check if ep2ap has recovered Au, Phi_u, Av, Phi_v 0016 max(max(max(abs(rAu-Au)))) % = 9.9920e-16 0017 max(max(max(abs(rAv-Av)))) % = 6.6613e-16 0018 max(max(max(abs(rPhi_u-Phi_u)))) % = 4.4764e-13 0019 max(max(max(abs(rPhi_v-Phi_v)))) % = 1.1369e-13 0020 max(max(max(max(abs(w-rw))))) % = 1.3710e-15 0021 % for the random realization I had, the differences are listed on the right 0022 % hand of the above column. What are yours? 0023 0024 % The above example function calls have already plotted an ellipse for you. 0025 % To plot an ellipse separately, you may do 0026 % 0027 figure(3) 0028 clf 0029 plot(real(squeeze(w(2,3,1,:))), imag(squeeze(w(2,3,1,:)))); 0030 0031 %here squeeze is needed because w is a multiple dimensional array. 0032 0033 0034 %Zhigang Xu 0035 %Nov. 12, 2000