0001 function plotsol(p,wnr,cnr,pstyle,varargin)
0002
0003
0004
0005
0006 if(cnr>p.neq)
0007 if(cnr==10) u=sqrt(p.u(1:p.np).^2+p.u(p.np+1:2*p.np).^2); end
0008 if(cnr==11) u=sqrt(p.u(2*p.np+1:3*p.np).^2+p.u(3*p.np+1:4*p.np).^2); end
0009 if(cnr==12) u=sqrt(p.u(1:p.np).^2+p.u(p.np+1:2*p.np).^2+...
0010 p.u(2*p.np+1:3*p.np).^2+p.u(3*p.np+1:4*p.np).^2); end
0011 if(cnr==13) u=angle(p.u(1:p.np)+1i*p.u(p.np+1:2*p.np)); end
0012 else n0=(cnr-1)*p.np+1; n1=cnr*p.np; u=p.u(n0:n1);
0013 end
0014 figure(wnr);
0015 if pstyle==1 pdemesh(p.points,p.edges,p.tria,u); end
0016 if pstyle==2 pdeplot(p.points,p.edges,p.tria,'xydata',u); end
0017 if pstyle==3 h=pdesurf(p.points,p.tria,u);view(10,60);
0018 light('Position',[-5 -5 5],'Style','local','Color',[1 1 1]);
0019 lighting phong
0020 set(h,'FaceLighting','flat','FaceColor','interp','AmbientStrength',0.7)
0021 end
0022 try, colormap(p.cm); catch, colormap gray; end;
0023 if pstyle==4 pdemesh(p.points,p.edges,p.tria); end
0024 axis tight;
0025 if pstyle==5
0026 x=p.points(1,:)'; y=p.points(2,:)';
0027 xmin=min(x); xmax=max(x); ymin=min(y); ymax=max(y);
0028 nx=20; ny=20;
0029 xg=linspace(xmin,xmax,nx);yg=linspace(ymin,ymax,ny);
0030 [ug,tn,a2,a3]=tri2grid(p.points,p.tria,p.u(1:p.np),xg,yg);
0031 vg=tri2grid(p.points,p.tria,p.u(p.np+1:2*p.np),tn,a2,a3);
0032 quiver(xg,yg,-vg,ug,0.7,'LineWidth',1);
0033 axis([-3 3 -3 3]);
0034 end
0035 if pstyle==6
0036 x=p.points(1,:)'; y=p.points(2,:)';
0037 xmin=min(x); xmax=max(x); ymin=min(y); ymax=max(y);
0038 nx=20; ny=20;
0039 xg=linspace(xmin,xmax,nx);yg=linspace(ymin,ymax,ny);
0040 [ug,tn,a2,a3]=tri2grid(p.points,p.tria,p.u(2*p.np+1:3*p.np),xg,yg);
0041 vg=tri2grid(p.points,p.tria,p.u(3*p.np+1:4*p.np),tn,a2,a3);
0042 quiver(xg,yg,-vg,ug); axis([-3 3 -3 3]);
0043 end
0044 box on;
0045 title(varargin);