ok i understand...but i have to confirm that i have fully understand what you have sent:
first of all i create a .pl file called xfoilwrapper (which starts with :" #!/usr/bin/perl "), then i create a .m file called codexfoil.m (starts with "% get_coeffs - Get the lift and drag coefficients for an airfoil") which calls the first one and then i write in command window of matlab:
>> [CL, CD] = get_coeffs(1.0, 40000, 0.3, '0012'). is that right ? thnx
they didn't have the same name and this was the problem!thanks a lot.
now a new problem appears:
??? Error: Unexpected MATLAB operator.
Error in ==> get_coeffs at 18
eval(perl('xfoilwrapper.pl', alfa, Re, Ma, NACA));
do you have any idea?
what is more i created the .pl file in notepad as kazz81 did.. do i need to follow the steps you told him ? if yes where should i put !perl -v you told him ?
hi azredwing,
this is how i am calling the function :
>> get_coeffs(2.0, 30000, 0.2, '1112')
and the error that appears is :
??? Error using ==> perl at 82
System error: ’¦ ©η©«£ ›¤ ε¤ © β© ¤ ¤«¦§ε© «¤
΅¦¨ ©£β¤ › ›¨¦£γ ›ε©΅¦¬.
Couldn't open coeffs.txt for reading: No such file or directory at
xfoilwrapper.pl line 10.
Command executed: perl xfoilwrapper.pl 2.00000 30000 0.20000 1112
Error in ==> get_coeffs at 18
eval(perl('xfoilwrapper.pl', alfa, Re, Ma, NACA));
do you have any idea?
as for the perl, when should i type !perl-v (before calling the previous function)?
thanks in advance...
Hi Folks,
I too am interested in getting matlab talking to xfoil. I have worked with PABLO in the past, but XFOIL is industry standard. I too am running windows and matlab 7.4. I'm hitting an error probably due to an old perl version.
However, my question is can we get this perl script to also output moment coefficient about the quarter chord and centre of pressure location. I.e expand the matlab function to:
function [CL,CD, CM, XCP] = get_coeffs(alfa, Re, Ma, NACA)
That would be golden. Furthermore, instead of specifing a NACA string can we make it a pointer to a file of coordinates that XFOIL can read?
If these features can be included that will be one powerful simulation tool!
I'll work on this as well and post any progress I make.
Cheers
Just a quick update, not sure if people are still interested. I got this working on windows.
First thing to do is to install the latest perl. Then when I tried to run the xfoilwrapper an error was thown because MATLAB was still looking at the old perl.exe file. I followed the link into the m file where the error was being hit and editied the path line to point it to the new perl.exe.
Next install the latest xfoil.
Finally in the xfoilwrapper.pl file locate the function "system", and replace the line with exactly:
system("xfoil <commands.xfoil >nul")
Also make sure the command list that is being generated is suitable for the xfoil version you are running. Do this by making a copy of commands.xfoil, then manually open xfoil and enter each line of the commands.xfoil file making sure no problems are hit in xfoil.
I have changed a lot of things in the xfoilwrapper file to suit my needs, it is not that hard once you get your head around it.
Hope that helps.
hi aaepl,
when i call the function get_coeffs the message i wrote above appears. do you have any idea?beacause in lines where the problem is ,they aren't the same as yours...
thanks
Hi Nikolhs,
I cant say exactly what your problem is. That error indicates that xfoil has not successfully run. This can be because of a number of things but I am betting that there is a problem in your commands.xfoil file that is being generated (provided it is being generated).
What you need to do is prevent the wrapper from deleteing the commands.xfoil file when the erorr is hit (search through the code and you will see what to comment out). Then open the commands.xfoil file and see what has been written. Manually open xfoil and enter each command from the commands.xfoil file manually to try and locate the problem.
If there are no problems there then I would suggest that your perl file is not opening xfoil and sending the commands.xfoil file properly. Make sure your 'system' command line is:
system("xfoil <commands.xfoil >nul")
If everything runs properly a coeff.txt is generated with all the coefficients. I use matlab to open that and parse through it. Thats all I can offer.
Cheers.
Bookmarks