interpolation between two fixed points
6 次查看(过去 30 天)
显示 更早的评论
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 个评论
John D'Errico
2020-6-1
Your question i almost impossible to answer, without any information about what is being interpolated, and what the vectors of numbers indicate.
回答(1 个)
John D'Errico
2020-6-2
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
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!