Home > demos > gpsol > plotsol.m

plotsol

PURPOSE ^

plotsol customized for GP

SYNOPSIS ^

function plotsol(p,wnr,cnr,pstyle,varargin)

DESCRIPTION ^

 plotsol customized for GP
 eg: plot |u1+i v1| for cnr=10, |u2+i v2| for cnr=11,
 arg(u1+i v1) for cnr=13
 quiver (-v1,u1) for pstyle=5, and (-v2,u2) for pstyle=5

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function plotsol(p,wnr,cnr,pstyle,varargin)
0002 % plotsol customized for GP
0003 % eg: plot |u1+i v1| for cnr=10, |u2+i v2| for cnr=11,
0004 % arg(u1+i v1) for cnr=13
0005 % quiver (-v1,u1) for pstyle=5, and (-v2,u2) for pstyle=5
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 %|phi_1|^2
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 %|phi_2|^2
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 %|phi_1|^2+|phi_2|^2
0011 if(cnr==13) u=angle(p.u(1:p.np)+1i*p.u(p.np+1:2*p.np)); end % arg phi
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; % cool, jet, autumn, lines
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);

Generated on Wed 15-Aug-2012 12:53:02 by m2html © 2005