okay, but using xfoil, you can only get the Cl and cd with one flap angle, for many general angle of attack... I would like to get the opposite !
It's more awkward in XFOIL to slice the problem along lines of constant flap deflection, but you can do it. One way is to store each flap deflection as a separate section shape. Then use a script to flip between them as you calculate one point at a time at a constant angle of attack.
Probably the easiest thing to do is to calculate angle of attack polars, then read them into a spreadsheet and plot them vs flap deflection. XFOIL's polars are ASCII text files, so they read into Excel very simply - just use "space" as the delimiting character. Then create a summary sheet that links to the data in the sheets for each polar file.
Anyway the point of my question is how do you calculate those values during a simulation with matlab or something like that ? what transfer function can be used ?
What's typically done in a simulation is one builds tables of coefficients that are a function of independent variables like angle of attack, sideslip angles, control deflections, etc. Each point in the table is computed one point at a time. For example, in a simulation I'm building at work, we are using five-dimensional tables (5 independent variables, one dependent variable, and a different table for each dependent variable), and I'm planning a wind tunnel test to collect over 23,000 points to populate the tables.
Then you read the tables into the simulation at start-up, or use an autocode generator (which can be as simple as a spreadsheet macro) to embed them directly into the code. As the simulation runs, the dependent variables described by each table are interpolated based on the values of the independent variables at that time in the simulation run. There are efficient interpolation techniques that can handle large tables without getting bogged down, such as starting the search for the appropriate set of knots based on the place in the table from the previous time step, since a continuous system can't make big jumps if you are using an adequate iteration rate.
The number of points you have to compute explodes as you add independent variables if you're doing a full-factorial exploration of the design space. An alternative is to curve fit the data, often called a response surface, and use a design-of-experiments approach to cut down on the number of points you have to calculate to get a decent representation. Then you can evaluate the curve fit instead of having to do table look-ups.
State variable models are used in Matlab to calculate the transfer functions. These are bilinear systems in the form of
xdot = A*x + B*u
y = C*x + D*u
The independent variables in the tables will typically be states or functions of the states. Flap deflections are either treated as input controls ("u" vector), or are the output of subsidiary transfer functions that capture the sensor and actuator dynamics. You will probably have to differentiate the data tables (or curve fits) to get the derivatives of the accelerations (state rates) as a function of the independent variables so you can build the "A" and "B" matrices.
With a feedback control system like a Moth, the flap deflection becomes a function of the states in the control system, often of the form
u = K*(command-x)
So the state model of the closed loop system becomes
xdot = [A - B*K]*x + K*command
y = [C-D*K]x + D*K*command
The closed loop transfer function is calculated from
y/command = [C-D*K]*[s*I-(A - B*K)]^-1*K + D*K
At heart of it all are the tables computed one point at a time.