navg = 11;
filenames = cell(navg,1);
for i = 1:navg
filenames = sprintf('queen2_test_%d.txt', i);
mydata{i}=importdata(filenames);
R = mydata{i}(:,1);
C = mydata{i}(:,2);
U = mydata{i}(:,3);
V = mydata{i}(:,4);
F = mydata{i}(:,7)./5;
rg = linspace(0, max(R), 100);
cg = linspace(0, max(C), 100);
[Rg, Cg] = meshgrid(rg, cg);
Fg = griddata(R, C, F, Rg, Cg);
Ug = griddata(R, C, U, Rg, Cg);
Vg = griddata(R, C, V, Rg, Cg);
figure
ax = axes();
caxis([-5 5])
colorbar
ax.YDir = 'reverse';
hold on;
contourf(Rg,Cg,Fg);
colormap(bluewhitered);
ax.XAxisLocation = 'top';
grid on;
hold on
quiver(R,C,U,V)
xstart = linspace(0, max(R), 50);
ystart = 0.004*ones(size(xstart));
s = streamline(Rg,Cg,Ug,Vg,xstart,ystart);
axis([0.02 0.07 .01 0.1])
set(gca,'XTick',0.02:.02:.07)
set(gca,'XTickLabel',0.2:0.2:.7)
set(gca,'YTick',0:.02:.1)
set(gca,'YTickLabel',0:0.2:1)
xlabel('x/c')
ylabel('y/c')
h = colorbar;
pos = get(h,'Position');
h.Label.Rotation = 0;
h.Label.Interpreter = 'latex';
h.Label.String = '$\ C_{p}$';
set(gca, 'Color', 'black');
exportgraphics(gcf,[filenames(1:end-4),'.png'], 'Resolution', 600);
delete(gcf);
end
Best Answer