# Set default parameters for the plots
set(0, "defaultlinelinewidth", 2);
set (0, "defaulttextfontname", "TimesNewRoman")
set (0, "defaulttextfontsize", 20)
set (0, "DefaultAxesFontName", "TimesNewRoman")
set(0, 'DefaultAxesFontSize', 20)
i_a =[0,1,2,3,4,5,6,9,12];
velo = zeros(size(i_a));
stddev = zeros(size(i_a));
y = zeros(size(i_a));
for i=1:1:size(i_a)(2)
filename = sprintf('d-%d-2.csv',i_a(i));
df = csvread(filename);
y(i) = i_a(i)*0.3;
velo(i) = mean(df(2:end-2,3));
stddev(i) = std(df(2:end-2,3));
end
yf = linspace(min(y), max(y), 60);
f = interp1(y, velo, yf,'spline');
errorbar(y, velo, stddev);
hold on;
plot(yf, f, '-k');
xlabel("axial distance from fan (in m)");
ylabel("Averaged velocity (m/s)");
hold off;
xlim([0 4]);
i_a =[0,2,4,6];
velo = zeros(size(i_a));
stddev = zeros(size(i_a));
y = zeros(size(i_a));
for i=1:1:size(i_a)(2)
filename = sprintf('d-9-%d.csv',i_a(i));
df = csvread(filename);
y(i) = i_a(i)*0.3;
velo(i) = mean(df(2:end-2,3));
stddev(i) = std(df(2:end-2,3));
end
yf = linspace(min(y), max(y), 60);
f = interp1(y, velo, yf,'spline');
errorbar(y-mean(y), velo, stddev);
hold on;
plot(yf-mean(yf), f, '-k');
xlabel("transverse distance from axis at 2.7m");
ylabel("Averaged velocity (m/s)");
hold off;
files = dir('*.csv');
num_files=length(files);
points = zeros(num_files,2);
velo = zeros(num_files,1);
for i=1:1:num_files
filename = files(i).name;
[s, e, te, m, t, nm, sp] = regexp (filename,'d-(.*)-(.*).csv');
matches = cell2mat(t);
matches = str2double(matches);
xlocs = matches(2);
ylocs = matches(1);
df = csvread(filename);
velo(i) = mean(df(2:end-2,3));
points(i,1) = xlocs; points(i,2) = ylocs;
end
xg = linspace(min(points(:,1)), max(points(:,1)),50);
yg = linspace(min(points(:,2)), max(points(:,2)),50);
[Xg, Yg] = meshgrid(xg,yg);
Vg = griddata(points(:,1),points(:,2), velo, Xg, Yg, 'linear');
pcolor(Xg,Yg,Vg); colorbar();