CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   XFOIL in MATLAB (http://www.cfd-online.com/Forums/main/15186-xfoil-matlab.html)

asd May 13, 2008 10:00

XFOIL in MATLAB
 
Does anyone know how to process XFOIL commands through MALTAB? I am able to open the program through the !shell command, but how does one enter the commands in MATLAB for execution in XFOIL.


ChrisDanger January 18, 2011 05:38

I know this is an old question, but in case anyone needs to do this...

You have to write a text file of inputs, which have on each line what you would enter into the command prompt. Then run that file with the shell command into XFoil.

I ran this first:
Code:

fid = fopen('XFoil_inputs.dat', 'wt');
fprintf(fid,['naca ' airfoil '\r']); % load this profile
fprintf(fid,'ppar\r'); % enter panelling parameters menu
fprintf(fid,['n 280\r']); % change the number of panels from 140 (default) to 280 (maximum)
fprintf(fid,'\r'); % carriage return
fprintf(fid,'\r'); % carriage return
fprintf(fid,'gdes\r'); % enter the geometry design menu
fprintf(fid,'flap\r'); % create a flap
...

...to generate a file with these contents:
Code:

naca 23012
ppar
n 280


gdes
flap
...

Then from Matlab execute !XFoil.exe<XFoil_inputs.dat, or whatever your filenames may be.


All times are GMT -4. The time now is 18:01.