interpolation between two fixed points

조회 수: 7 (최근 30일)
Mari Norwie
Mari Norwie 2020년 6월 1일
답변: John D'Errico 2020년 6월 2일
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
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.
Mari Norwie
Mari Norwie 2020년 6월 2일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

John D'Errico
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

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by