# How to generate NACA Foil using Matlab ## What is NACA ?

The NACA (National Advisory Commite For Aeronautics) airfoils were designed during the period from 1929 through 1947 under the directionof Eastman Jacobs at the NACA’s Langley Field Laboratory. NACA established since (1915 – 03 – 03 ~ 1958 – 09 – 03) after Russian Satelit Sputnik 1 Launched (1957 -10-4) now become NASA (National Aeronautics and Space Administration) since 1958 – 10 – 01 until now.

The NACA airfoils are constructed by combining a thickness envelope with a camber or meanline. The equations which describe this procedure are:

$$x_{u}=x-y_{t}(x)sin \theta$$
$$y_{u}=y_{c}+y_{t}(x)cos \theta$$

and

$$x_{l}=x+y_{t}(x)sin \theta$$
$$y_{l}=y_{c}-y_{t}(x)cos \theta$$

where $$y_{t}(x)$$ is the thickness function, $$y_{c}(x)$$ is the camber line function, and

$$\theta =tan^{-1}(\frac {dy_c}{dx})$$

## The Naca 4-Digit Airfoil

The numbering system for these airfoils is defined by:

$$NACA \space – \space MPXX$$

Where;
$$XX$$ is the maximum thickness, $$t/c$$, in percent chord.
$$M$$ is the maximum value of the mean line in hundredths of the chord
$$P$$ is the chordwise position of the maximum camber in tenths of the chord.

The NACA 4-digit thickness distribution is given by:

$$\frac {y_{t}}{c}=(\frac {t}{c})a_{0}\sqrt{x/c}-a_{1}(x/c)-a_{2}(x/c)^{2}+a_{3}(x/c)^{3}-a_{4}(x/c)^{4}$$

$$a_{0}=1.4845$$
$$a_{1}=0.6300$$

$$a_{2}=1.7580$$
$$a_{3}=1.4215$$

$$a_{4}=0.5075$$

The camber line is given by:

$$\frac{y_{c}}{c}=\frac{M}{P^{2}}[2P(x/c_-(x/c)^{2}]; \space (\frac{x}{c}\leq P)$$

$$\frac{dy_{c}}{dx}=\frac{2M}{P^{2}}(P-(x/c))$$

$$\frac{y_{c}}{c}=\frac{M}{1-P^{2}}[1-2P+2P(x/c_-(x/c)^{2}]; \space (\frac{x}{c}\geq P)$$

$$\frac{dy_{c}}{dx}=\frac{2M}{1-P^{2}}(P-(x/c))$$

## Coding Matlab NACA Foil

this example code to generate NACA 0010 it’s mean $$M$$= 0, $$P$$= 0, $$XX$$= 10/ 100 = 0.1

% INPUT 4 DIGIT NACA AIRFOIL) %
%-----------------------------%
a0=1.4845;
a1=0.6300;
a2=1.7580;
a3=1.4215;
a4=0.5075;
M=0.00;
P=0.0;
XX=0.10;

% 2-Dimensional %
%---------------%
x=linspace(0,1,101);
% Thickness Distribution
yt=XX*(a0*sqrt(x)-a1*x-a2*(x.^2)+a3*(x.^3)-a4*(x.^4));
% Camber Line
for i=1:101;
xc=(i-1)/100
if xc<P
ycc=(M/P^2)*(2*P*xc-xc.^2);
thetac=atan(2*M/(P^2)*(P-xc));
else
ycc=(M/(1-P)^2)*(1-2*P+2*P*xc-xc.^2);
thetac=atan(2*M/(1-P^2)*(P-xc));
end
yc(1,i)=ycc;
theta(1,i)=thetac;
end
% Plot
xu=x-yt.*sin(theta);
yu=yc+yt.*cos(theta);
xl=x+yt.*sin(theta);
yl=yc-yt.*cos(theta);
plot(xu,yu,xl,yl,x,yc)
xlabel('X-Axis'),ylabel('Y-Axis'),zlabel('Z-Axis')
title('NACA 0010')
axis equal;
hold on;