Problem in interpolation of data.

조회 수: 1 (최근 30일)
Daniyal Ali
Daniyal Ali 2015년 10월 13일
댓글: Walter Roberson 2015년 10월 13일
The following code is giving me the error that "The grid vectors do not define a grid of points that match the given values". I tried to use linear and other methods too, but nothing works. Need help.
a=unique(Eo.signals.values(:,:));
b=unique(SOC.signals.values(:,:));
b1 = interp1(a,b,19,'spline','extrap')

채택된 답변

Walter Roberson
Walter Roberson 2015년 10월 13일
What reason do you have for expecting that the number of unique values of one kind matches the number of unique values of the other kind, and that they should happen to be sorted in the same order?
are you sure you want to extrapolate at 19 exactly? That reads more like a number for the number of extrapolated values you would want.
I wonder if maybe you are looking for something closer to a cubic spline fit of the data?
  댓글 수: 2
Daniyal Ali
Daniyal Ali 2015년 10월 13일
My a ranges from 25 to 17 having values like 24.9 24.8 in between also. My b ranges from 1 t0 0 having values like 0.01 0.02 etc. Both a and b depend on each other and there is a certain value of a corresponding to a certain value of b.
What i want is to get the value of b, by entering any value of a between the range of values shown. That's why i am using the interpolation method.
Walter Roberson
Walter Roberson 2015년 10월 13일
Use the three output form of unique() to produce A and ia and ic (third output). Use ic to index the second array to get the values corresponding to each A value. Then the two will be the same length and in correspondence.

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

추가 답변 (0개)

카테고리

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