If you know about the Nomenclature of NACA 4 digit airfoil but you are wondering how you can plot it using MATLAB or any other programming tools then this post is for you. A detailed explanation about NACA 4 digit airfoil has been presented in one of our previous posts. Since you’ve come here, I assume that you know the basics of NACA 4 digit airfoil and also the fundamentals of MATLAB.
Check out our previous post explaining the nomenclature and equations of NACA 4 digit airfoil https://www.geniuserc.com/naca-4-digit-airfoil-nomenclature-and-equations/
Basics of NACA 4 digit Airfoil
The NACA airfoils are airfoil shapes for aircraft wings developed by the National Advisory Committee for Aeronautics (NACA). The shape of the NACA airfoils is described using a series of digits following the word “NACA”. The parameters in the numerical code can be entered into some analytical equations to precisely generate the cross-section of the airfoil and calculate its properties. In the early periods of aircraft developments, aircraft designers used to design the shape of airfoil randomly based on intuition or some experiments.
Any NACA 4 digit airfoil can be broken down into following fragments,
M – Maximum camber divided by 100.
P – Position of maximum camber divided by 10.
XX – Thickness divided by 100.
For an example,
NACA 2412 can be broken down into these fundamental bullets,
- M = 2 , the camber is 2% of the chord.
- P = 4, the maximum camber is at 40% of the chord.
- XX =12, the thickness is 12% of the chord.
The equations, for your reference, are given down below.
(For detailed explanation about these equations, please check out our previous post about NACA 4 Digit Airfoil)
Let us move to the part where the real fun lies , THE MATLAB.
The first step will be specifying the chord length and asking the user the 4 digits of airfoil. Here, you can prompt the user to type in the chord length as well instead of specifying by yourself.
Here the input we took from the user is in the form of string and thus we must convert it to double. For this, we use str2double and specify the location of the data we want to pull. This is illustrated in the code below. You can read the comments for further information.
Here, since M is maximum camber divided by 100, which is the camber presented in percentage of chord, so we divide the number by 100. Similarly, we do the same for the rest.
Now, its time to specify the value of a variable x, where limit will be 0 to the chord length which will be divided thoroughly into 10000 segments. You can specify the segments as per your wish. The more it is, the fine you’ll get the graph. 10,000 will be more than enough in this case.
x=linspace(0, c, 10000);
In this step, we write the general equation. And we use the for loop in order to specify two cases that we have in the equations. Later in this, we calculate the upper and lower limits.
Now is the time to plot it. We use plot function in order to do so. And labelling is done accordingly. You can modify the colour of plot as per your preference.
Here are the snapshots of NACA2412 and NACA 0012 airfoils
Thank you for reading till the end. Feel free to give your views about this post in the comments. Lastly, I want to make it easier for you to copy the code. Here you go:
c=1.524; %chord length
s=input(‘Enter the NACA 4 DIGIT AIRFOIL: ‘,’s’);
NACA=s; %4 digits
d1=str2double(s(1)); % pulls the first digit out of the scalar
d2=str2double(s(2));% pulls the second digit out of the scalar
d34=str2double(s(3:4)); % pulls the third and fourth digit out of the scalar
x=linspace(0, c, 10000);
for k = 1:length(x)
if x(k) <= p*c
elseif x(k) > p*c
%plot of airfoil
title(‘NACA 4 digit Airfoil Plot’)
Do you want to know more about airfoil data? You can check out this site http://airfoiltools.com/airfoil/details?airfoil=naca0006-il