File Exchange

image thumbnail

Xfoil Interface

version (3.87 KB) by Gus Brown
Run Xfoil from Matlab. This is an interface to the original XFoil program.


Updated 18 Feb 2011

View Version History

View License

This simple function will use a system call to run Xfoil. It then loads the results into a data structure which you can then use in your Matlab script.

For example to deflect the trailing edge of a NACA0009 by 5deg at 65% chord and run multiple incidence angles...
[pol foil] = xfoil('NACA0009',[-5:15],1e6,0.2,'oper iter 150','gdes flap 0.65 0 5 exec')
The coefficents will be returned in the pol structure while the foil data and pressure distribution will be returned in foil structure.

XFOIL, first developed by Mark Drela at MIT, is a program for the design and analysis of subsonic isolated airfoils and is released under the GNU General Public License.
You can find Xfoil here:

Cite As

Gus Brown (2020). Xfoil Interface (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (17)

dw xue

qc sui

To save the followers' time, if you have problem with the dumpfile, maybe it is because you should pass the airfoil's .dat coordinate filename to coord variable, NOT your xy coordinate.

Jeffrey Hanson

I type in the following from the examples and get the following error.
>> foil = xfoil('NACA0012',10,1e6,0.2,'oper/vpar n 12')
Index exceeds matrix dimensions.

Error in xfoil (line 229)

Reuben Lew

I had this error,
Error using perl (line 79)
System error: The system cannot find the path specified.
Couldn't open coeffs.txt for reading: No such file or directory at line 10.
Command executed: perl 5.00000 1000000 0.20000 0012
anyone has any idea?

samuel farah

I had this error:
Attempted to access P.%cell(1); index out of bounds because numel(P.%cell)=0.

Error in xfoil (line 229)
pol.xtrf_top = P{1}(1);

Any help?



I have the following error :

Error using xfoil (line 158)
Xfoil execution failed! cd H:\Documents\Iboat\Xfoil && xfoil.exe < xfoil.inp > xfoil.out

Xfoil.exe is in the right directory, I checked everything and I cannot find what is wrong. Can you help me?

Thank you


anybody please give some idea about, how to develop matlab code for interpolation ('INTE') option in XFOIL.




How can I to work with another airfoil as xxx.dat/xxx.txt? Please ...any one that help me.


Fadi Kahwash

Thanks a lot for the useful code.
I'm gonna use it in my MSc project, with due acknowledgment of course...

Thomas Hansen

Fantastic:) Is there a way to suppress the xfoil window?

Sönke N

A note for linux users:
probably a workaround for some gfortran environment variables has to be applied.


Absolutely impressive !
I just made some modifications in order to run it on a Linux config, but really very few.
Very great work !

David Pate


Nate Jensen

MATLAB Release Compatibility
Created with R2007a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!