%% PLOT grids clear all close all % Read in data files with ALL nodes clear all close all U=dlmread('hw1belnodesoln.dat') xyu=dlmread('hw1coord.dat') x=xyu(:,1); y=xyu(:,2); u=U(:,1); plot(x,y) axis image scatter(x,y) figure xyu=dlmread('hw1allnodesoln.dat') x=xyu(:,1); y=xyu(:,2); u=xyu(:,3); scatter(x,y) %scatter(x,u) %% Plot SOln for part 1 or 2 clear all close all clc %hold on % Read in data files with ALL nodes xyu=dlmread('hw1allnodesoln.dat') x=xyu(:,1); y=xyu(:,2); u=xyu(:,3); [yn,xn]=meshgrid(-1.02:.01:1.02,-1.02:.01:1.02); % Display #1 in 2D figure Un=griddata(x,y,u,xn,yn); % Calculate the interpolated values for plotting on a finer grid system contourf(xn,yn,Un,100,'LineStyle','none') %Plot a filled 3D Contour without lines set(gca,'DataAspectRatio',[1 1 1]) % fix the aspect ration to 1:1:1 axis image % Display #2 in 3D figure surf(Un,'LineStyle','none') % Read in dU/dx and dU/dy results for vector plotting vel=dlmread('hw1derivativeuinterior.dat') xx=vel(:,1); yy=vel(:,2); uu=vel(:,3); vv=vel(:,4); figure quiver(xx,yy,uu,vv),axis image %% Plot Difference between part1 and part 2 solns clear all close all xyu=dlmread('part2allnodessoln.dat'); x2=zeros(1224,1); y2=zeros(1224,1); z2=zeros(1224,1); u2=zeros(1224,1); % read in data file for ALL nodes part 2 x2(1:13,1)=xyu(1:13,1); x2(14:24,1)=xyu(15:25,1); x2(25:end,1)=xyu(27:end,1); y2(1:13,1)=xyu(1:13,2); y2(14:24,1)=xyu(15:25,2); y2(25:end,1)=xyu(27:end,2); u2(1:13,1)=xyu(1:13,3); u2(14:24,1)=xyu(15:25,3); u2(25:end,1)=xyu(27:end,3); % Read in data files with ALL nodes part 1 xyu=dlmread('part1allnodessoln.dat') x1=xyu(:,1); y1=xyu(:,2); u1=xyu(:,3); %difference udiff=abs(u1-u2); [yn,xn]=meshgrid(-1.02:.01:1.02,-1.02:.01:1.02); % Display #1 in 2D figure Un=griddata(x1,y1,udiff,xn,yn); % Calculate the interpolated values for plotting on a finer grid system contourf(xn,yn,Un,100,'LineStyle','none') %Plot a filled 3D Contour without lines set(gca,'DataAspectRatio',[1 1 1]) % fix the aspect ration to 1:1:1 axis image % Display #2 in 3D figure surf(Un,'LineStyle','none')