0001 function plot(vtm,X,AV,Ar,last)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 global RELEASE
0017
0018
0019
0020 if nargin<4
0021 if(size(X,1)>=8)
0022 Ar=X;
0023 else
0024 Ar=[];
0025 end
0026 last=zeros(1,size(X,2));
0027 elseif(nargin<5)
0028 last=zeros(1,size(X,2));
0029 end
0030
0031
0032 fs = 10000;
0033 t = [0:1/fs:0.01]';
0034 y = sin(2*pi*t*500);
0035
0036
0037 AVval(:,1) = 275+50/0.01*t;
0038 AVval(:,2) = 525+25*y;
0039
0040 for i=1:size(X,2),
0041 [Ft,Bt,At,Af{i},Tf{i},P1{i},P2t] = doAM(X(1:7,i));
0042
0043 diva_drawman(P1{i},P2t,X(1,i),AV(i),AVval,last(i));
0044
0045 drawAreaFunc(X(1:7,i),vtm);
0046
0047 [TP,TL]=miniAr2Tac(Ar(:,i),X(:,i));
0048
0049
0050
0051 drawPalate(TP);
0052
0053
0054 drawLips(TL);
0055 hold off;
0056
0057 drawnow;
0058 end
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077 function drawLips(TL)
0078
0079 yoff=350;
0080 xlow=50;
0081 xhigh=270;
0082 xstep=3;
0083
0084 TL=8-TL;
0085 hold on;
0086 y=ones(1,3).*yoff;
0087
0088 y(2)=yoff-TL*8;
0089 x=linspace(xlow,xhigh,xstep);
0090 xi=linspace(xlow,xhigh);
0091 yi=interp1(x,y,xi,'pchip');
0092 plot(xi,yi,'k','LineWidth',5);
0093
0094 y(2)=yoff+TL*8;
0095 x=linspace(xlow,xhigh,xstep);
0096 xi=linspace(xlow,xhigh);
0097 yi=interp1(x,y,xi,'pchip');
0098 plot(xi,yi,'k','LineWidth',5);
0099 hold off;
0100 return
0101
0102 function drawPalate(TP)
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117 xoff=130;
0118
0119 y_min=650;
0120 x_min=40;
0121 amp=50;
0122 amp_step=12;
0123 hold on
0124 yoff=250;
0125 b=[3.6 3.9 3.2 3.0 2.8 2.6 2.4 2.2 2.0];
0126 a=[3.7 3.9 3.3 2.8 2.3 1.8 1.3 0.8 0.6];
0127 c=1;
0128 cc=2;
0129
0130 t=pi/2;
0131 pnode=[9 8 7 5 4];
0132 j=1;
0133 theta=linspace(pi/2,3*pi/2,200);
0134 tlabel={'l1','l2','l3','l4','l5'};
0135 for i=1:1:9
0136 xt=[];
0137 yt=[];
0138 if(~mod(i,2)),
0139 xt=a(i)*sin(theta);
0140 yt=b(i)*cos(theta);
0141 xt=(xt+1)*35+xoff;
0142 yt=yt*amp+250;
0143
0144 cstr='k';
0145 else
0146 n=pnode(j)*4;
0147 cc=2;
0148 t=pi/2;
0149 h=((a(i)-b(i))^2)/((a(i)+b(i))^2);
0150 C=pi*(a(i)+b(i))*(1+((3*h)/(10+sqrt(4-3*h))));
0151 C=C/4;
0152 L=C/n;
0153 if j<=3
0154 L=L+(.1*L);
0155 elseif j==5
0156 L=L-(.05*L);
0157 end
0158 ra=(c^2*a(i)^2*b(i)^2);
0159 rb=(b(i)^2*(cos(t)^2))+(a(i)^2*(sin(t)^2));
0160 r=sqrt(ra/rb);
0161 T=[];
0162 R=[];
0163 T(1)=t;
0164 R(1)=r;
0165 for k=2:n
0166 t=t+L/r;
0167 rb=((b(i)^2)*(cos(t)^2))+((a(i)^2)*(sin(t)^2));
0168 r=sqrt(ra/rb);
0169 if mod(k-1,4)==0
0170 T(cc)=t;
0171 R(cc)=r;
0172 cc=cc+1;
0173 end
0174 end
0175 xt=R.*cos(T);
0176 yt=-R.*sin(T);
0177 cstr='.k';
0178 order=length(xt):-1:1;
0179 xt=xt(order);
0180 yt=yt(order);
0181 order=length(xt)-1:-1:1;
0182
0183 xt=([xt -xt(order)]+1)*35+xoff;
0184 yt=[yt yt(order)]*amp+250;
0185
0186
0187 tpoints.(char(tlabel(j))).x=xt;
0188 tpoints.(char(tlabel(j))).y=yt;
0189 j=j+1;
0190
0191 end
0192 plot(xt,yt,cstr);
0193 end
0194 j=1;
0195 TP=TP+1;
0196 for i=1:5
0197 idx=6-i;
0198 plot(tpoints.(char(tlabel(i))).x(TP(i):-1:1), ...
0199 tpoints.(char(tlabel(i))).y(TP(i):-1:1),'*r')
0200 plot(tpoints.(char(tlabel(i))).x(end+1-(TP(i):-1:1)), ...
0201 tpoints.(char(tlabel(i))).y(end+1-(TP(i):-1:1)),'*r')
0202 end
0203 hold off
0204 return
0205
0206 function [TP,TL]=miniAr2Tac(Ar,X)
0207 if ~isempty(Ar)
0208 sizeAr2=size(Ar,2);
0209 else
0210 sizeAr2=1;
0211 end
0212
0213 Maeda2Palate=[ 4.9750 0.3910 -1.5280 0.3720 1.7100 0; ...
0214 3.8020 0.3940 -1.5770 0.6160 1.4490 0; ...
0215 2.1380 0.1940 -1.4440 0.6380 0.7930 0; ...
0216 0.3780 0.2830 -1.2290 0.6260 0.3220 0; ...
0217 -0.4840 0.3880 -0.8910 0.7030 0.3910 0; ...
0218 4.9190 0.2710 0.0280 -0.0040 -0.0010 -1.8114];
0219 MaedaParam=X;
0220
0221 T = max(min(Maeda2Palate*[ones(1,sizeAr2);MaedaParam(1:5,: )], ...
0222 repmat([9 8 7 5 4 9]',1,sizeAr2)),0);
0223
0224
0225 TP=T(1:end-1);
0226 TP=floor(TP);
0227 TL=T(end);
0228 return
0229
0230 function drawAreaFunc(X,vtm)
0231 tdata.X=X;
0232 tdata=getAreaFunc(vtm,tdata);
0233 y_min=650;
0234 x_min=40;
0235 bar_step=15;
0236 y_amp=20;
0237 hold on;
0238 for i=1:length(tdata.Af)
0239 line([x_min+i*bar_step,x_min+i*bar_step+bar_step],[y_min- ...
0240 tdata.Af(i)*y_amp,y_min-tdata.Af(i)*y_amp], ...
0241 'color','k');
0242 if(i>1)
0243 line([x_min+i*bar_step,x_min+i*bar_step],[y_min- tdata.Af(i)* ...
0244 y_amp,y_min-tdata.Af(i-1)* y_amp],'color','k');
0245 end
0246 end
0247 [mina mini]=min(tdata.Af);
0248 tot=length(tdata.Af);
0249 set(gca,'xtick',[],'xticklabel',[],'ytick',[],'yticklabel',[]);
0250 xlabel(sprintf('Min Area: %2.1f cm^2 Tube %d of %d',mina,mini,tot));
0251 return
0252