I made 9412 naca airfoil.
Can I draw streamline with this?
clear;close;clc;
name = '9412';
P = str2double(name(1))/100
M = str2double(name(2))/10
XX = str2double(name(3:4))/100
nx = 200;
xc = linspace(0, 1, nx);
ip = xc < M
yc(ip) = P./M.^2.*(2*M.*xc(ip) - xc(ip).^2);
dycdxc(ip) = 2.*P./M.^2.*(M-xc(ip));
ip = xc > M
yc(ip) = P./(1-M).^2.*((1-2.*M)+2.*M.*xc(ip)-xc(ip).^2);
dycdxc(ip) = 2.*P./(1-M).^2.*(M-xc(ip));
theta = atan(dycdxc);
a0 = 0.2969;
a1 = -0.1260;
a2 = -0.3516;
a3 = 0.2843;
a4 = -0.1015;
tc = a0.*xc.^(1/2) + a1.*xc + a2.*xc.^2 + a3.*xc.^3 + a4.*xc.^4;
xcu = xc-tc.*sin(theta);
ycu = yc+tc.*cos(theta);
xcl = xc+tc.*sin(theta);
ycl = yc-tc.*cos(theta);
figure(1)
hold on
plot(xcu, ycu, 'r.-')
plot(xcl, ycl, 'b.-')
plot(xc,yc,'ko-')
for i=1:nx
plot([xcu(i) xcl(i)], [ycu(i) ycl(i)], 'k-')
end
hold off
axis equal