0001 function w=plot_ell(SEMA, ECC, INC, PHA, IND)
0002
0003
0004
0005
0006
0007
0008
0009
0010 size_SEMA=size(SEMA);
0011 if nargin == 4;
0012 IND=1;
0013 end
0014
0015 len_IND=length(IND);
0016 if IND
0017 cmd=['sub2ind(size_SEMA' ];
0018 if len_IND==1
0019 titletxt=['Ellipse '];
0020 else
0021 titletxt=['Ellipse ('];
0022 end
0023
0024 for k=1:len_IND;
0025 cmd=[cmd ',' num2str(IND(k))];
0026 if k<len_IND
0027 titletxt=[titletxt num2str(IND(k)) ','];
0028 elseif len_IND==1
0029 titletxt=[titletxt num2str(IND(k))];
0030 else
0031 titletxt=[titletxt num2str(IND(k)) ')'];
0032 end
0033 end
0034
0035 cmd=['n=' cmd ');'];
0036 eval(cmd);
0037
0038 figure(gcf)
0039 clf
0040 do_the_plot(SEMA(n), ECC(n), INC(n), PHA(n));
0041 titletxt=[titletxt ', (red) green (anti-) clockwise component'];
0042 title(titletxt);
0043 elseif len_IND
0044 msg1=['IND input contains zero element(s)!'];
0045 msg2=['No ellipse will be plotted.'];
0046 disp(msg1);
0047 disp(msg2);
0048 end
0049
0050
0051
0052 function w=do_the_plot(SEMA, ECC, INC, PHA)
0053
0054 SEMI = SEMA.*ECC;
0055 Wp = (1+ECC)/2 .*SEMA;
0056 Wm = (1-ECC)/2 .*SEMA;
0057 THETAp = INC-PHA;
0058 THETAm = INC+PHA;
0059
0060
0061 THETAp = THETAp/180*pi;
0062 THETAm = THETAm/180*pi;
0063 INC = INC/180*pi;
0064 PHA = PHA/180*pi;
0065
0066
0067 wp = Wp.*exp(i*THETAp);
0068 wm = Wm.*exp(i*THETAm);
0069
0070 dot = pi/36;
0071 ot = [0:dot:2*pi];
0072 a = wp*exp(i*ot);
0073 b = wm*exp(-i*ot);
0074 w = a+b;
0075
0076 wmax = SEMA*exp(i*INC);
0077 wmin = SEMI*exp(i*(INC+pi/2));
0078
0079 plot(real(w), imag(w))
0080 axis('equal');
0081 hold on
0082 plot([0 real(wmax)], [0 imag(wmax)], 'm');
0083 plot([0 real(wmin)], [0 imag(wmin)], 'm');
0084 xlabel('u');
0085 ylabel('v');
0086 plot(real(a), imag(a), 'r');
0087 plot(real(b), imag(b), 'g');
0088 hnd_a=line([0 real(a(1))], [0 imag(a(1))], 'color', 'r', 'marker','o');
0089 hnd_b=line([0 real(b(1))], [0 imag(b(1))], 'color', 'g', 'marker','o');
0090 hnd_w=line([0 real(w(1))], [0 imag(w(1))], 'color', 'b', 'marker','o');
0091 plot(real(a(1)), imag(a(1)), 'ro');
0092 plot(real(b(1)), imag(b(1)), 'go');
0093 plot(real(w(1)), imag(w(1)), 'bo');
0094 hnd_ab=line(real([a(1) a(1)+b(1)]), imag([a(1) a(1)+b(1)]), ...
0095 'linestyle', '--', 'color', 'g');
0096 hnd_ba=line(real([b(1) a(1)+b(1)]), imag([b(1) a(1)+b(1)]), ...
0097 'linestyle', '--', 'color', 'r');
0098
0099 for n=1:length(ot);
0100 set(hnd_a, 'xdata', [0 real(a(n))], 'ydata', [0 imag(a(n))]);
0101 set(hnd_b, 'xdata', [0 real(b(n))], 'ydata', [0 imag(b(n))]);
0102 set(hnd_w, 'xdata', [0 real(w(n))], 'ydata', [0 imag(w(n))]);
0103 hold on
0104 plot(real(a(n)), imag(a(n)), 'ro');
0105 plot(real(b(n)), imag(b(n)), 'go');
0106 plot(real(w(n)), imag(w(n)), 'bo');
0107 set(hnd_ab, 'xdata',real([a(n) a(n)+b(n)]), 'ydata', ...
0108 imag([a(n) a(n)+b(n)]))
0109 set(hnd_ba, 'xdata',real([b(n) a(n)+b(n)]), 'ydata', ...
0110 imag([b(n) a(n)+b(n)]))
0111 end
0112
0113 hold off
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148