Effacer les filtres
Effacer les filtres

interpolation between two fixed points

1 vue (au cours des 30 derniers jours)
Mari Norwie
Mari Norwie le 1 Juin 2020
I would please like to know how to find the upper and lower values for interpolation a certain value.
VehicleState =
Struct with fields:
alpha:40
deBF:6
deSB:0
deA:0
AerodynamicData.Cm.BodyFlap
ans=
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]
How is the interpolation limits for deBF: 6 found in the above mentioned data?
  2 commentaires
John D'Errico
John D'Errico le 1 Juin 2020
Your question i almost impossible to answer, without any information about what is being interpolated, and what the vectors of numbers indicate.
Mari Norwie
Mari Norwie le 2 Juin 2020
This is the table I am given. I have to use the value the corrosponds with alpha and deBF for the VehicleState values.
My question is that as this values in VehicleState can change, how does one get the upper and lower values for interpolation to be able to get the interpolated value for the Value given in the VehicleState array?
For e.g. the Vehicle state array is giving the value deBF: 6 and alpha: 40.
So at alpha 40 i have to find the interpolated value of deBF 6. Logic dictates that the upper and lower values for deBF: 6 is 5 and 10. However, I have to be able to locate the values through automation and not hard coding.

Connectez-vous pour commenter.

Réponses (1)

John D'Errico
John D'Errico le 2 Juin 2020
I'd never have guessed what the quetion was from the initial question as written. But the answer is to use discretize.
You have some bin boundaries for deBF, and alpha.
deBFbins = [-11.7000 -5 0 5 10 16.3000 22.5000];
alphabins = [-10 -5 0 5 10 15 20 25 30 35 40 45 50];
In the case of alpha, it is easy to see where a number falls, since they are uniformly spaced. Simple arithmetic would suffice there.
deBF = 6;
ind = discretize(deBF,deBFbins)
ind =
4
deBFbins([ind,ind+1])
ans =
5 10
So it lives in bin #4, thus between 5 and 10.
You can use this for alpha also.
ind = discretize(40,alphabins)
ind =
11

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by