using linear interpolation to find coefficients

10 visualizaciones (últimos 30 días)
WILLBES BANDA
WILLBES BANDA el 28 de Mayo de 2020
Respondida: David Hill el 28 de Mayo de 2020
Hi, i want to create a function that interpolates linearly to give me the coefficients. As an example, the function must take in AerodynamicData.Cm.BodyFlap (see below) and must use VehicleState to find the interpolated value of CmBodyFlap, which is the contribution that the body flap makes towards the aerodynamic coefficient named, Cm.
AerodynamicData.Cm.BodyFlap =
struct with fields:
deBF: [-11.7000 -5 0 5 10 16.3000 22.5000]
alpha: [-10 -5 0 5 10 15 20 25 30 35 40 45 50]
CmBodyFlap: [7×13 double]
VehicleState =
struct with fields:
alpha: 40
Mach: 5
deBF: 6
deSB: 0
deA: 0
Please help.

Respuestas (2)

Sulaymon Eshkabilov
Sulaymon Eshkabilov el 28 de Mayo de 2020
Hi,
use polyfit(); e.g.
x = alpha; y = deBF; % then
Coeff= polyfit(x, y, N); % N=1 linear fit, N=2 second order polynomial fit, N=3 cubic polynomial, etc.

David Hill
David Hill el 28 de Mayo de 2020
Make sure your matrix agrees with the meshgrid generated or change it to match.
[d,a]=meshgrid(AerodynamicData.Cm.BodyFlap.deBF,AerodynamicData.Cm.BodyFlap.alpha);
CmBodyFlap_interp=interp2(d,a,AerodynamicData.Cm.BodyFlap.CmBodyFlap,VehicleState.deBF,VehicleState.alpha);

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by