using linear interpolation to find coefficients

15 visualizzazioni (ultimi 30 giorni)
WILLBES BANDA
WILLBES BANDA il 28 Mag 2020
Risposto: David Hill il 28 Mag 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.

Risposte (2)

Sulaymon Eshkabilov
Sulaymon Eshkabilov il 28 Mag 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 il 28 Mag 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);

Categorie

Scopri di più su Interpolation in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by