Page 4 of 8 FirstFirst ... 23456 ... LastLast
Results 31 to 40 of 80

Thread: XFOIL with MATLAB

  1. #31
    Join Date
    Apr 2008
    Beans
    135

    Re: XFOIL with MATLAB

    Quote Originally Posted by nikolhs View Post
    what do you mean matlab shell ? how can i be sure for this ?
    I can't really help you any more if you don't know the basics of MATLAB. I suggest you find tutorials or something online, because I must make a fundamental assumption that you know how to use MATLAB, scripts, functions, etc., and it seems you don't know how...

  2. #32
    Join Date
    May 2010
    Beans
    14

    Re: XFOIL with MATLAB

    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

  3. #33
    Join Date
    Apr 2008
    Beans
    135

    Re: XFOIL with MATLAB

    Quote Originally Posted by nikolhs View Post
    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
    Correct - except in MATLAB, the .m file must match the name of the function! So the file MUST be called get_coeffs.m or bad things happen.

  4. #34
    Join Date
    May 2010
    Beans
    14

    Re: XFOIL with MATLAB

    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 ?

  5. #35
    Join Date
    Apr 2008
    Beans
    135

    Re: XFOIL with MATLAB

    Quote Originally Posted by nikolhs View Post
    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 nikolhs,

    Just type !perl -v into the command window and paste your results back here. As for the error: Can you show me exactly how you're calling the function?

  6. #36
    Join Date
    May 2010
    Beans
    14

    Re: XFOIL with MATLAB

    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...

  7. #37
    Join Date
    Jul 2010
    Beans
    4

    Re: XFOIL with MATLAB

    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


  8. #38
    Join Date
    Jul 2010
    Beans
    4

    Re: XFOIL with MATLAB

    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.

  9. #39
    Join Date
    May 2010
    Beans
    14

    Re: XFOIL with MATLAB

    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

  10. #40
    Join Date
    Jul 2010
    Beans
    4

    Re: XFOIL with MATLAB

    Quote Originally Posted by nikolhs View Post
    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.

Page 4 of 8 FirstFirst ... 23456 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •