To plot an airfoil in MATLAB, you can use the airfoil2d function from the MATLAB FileExchange. Here are the steps:
Download the airfoil2d MATLAB function from the FileExchange or clone from GitHub.
Load the airfoil coordinates from a file. For example, the NACA0012 airfoil coordinates are available on the UIUC Airfoil Data Site. Download the data file for NACA0012, which has the name n0012.dat, and save it to your MATLAB working directory.
In MATLAB, load the airfoil coordinates from the file using the load function, and extract the x and y coordinates:
main.m93 chars5 lines
Call the airfoil2d function to plot the airfoil:
main.m32 chars3 lines
The airfoil2d function also supports adding additional features to the plot, such as a chord line, camber line, or marker points at arbitrary locations along the airfoil.
Here's an example plot:
main.m126 chars8 lines

gistlibby LogSnag