interp1 problem with Matlab2012

조회 수: 8 (최근 30일)
Vittoria D'Avino
Vittoria D'Avino 2015년 4월 16일
댓글: John D'Errico 2015년 4월 17일
Hi,
I have problem with this function but only with the v2012.
"Error using griddedInterpolant The coordinates of the input points must be finite values; Inf and NaN are not permitted."
Somebody know about this problem according to a Matlab version? The same package of function run well under other version!
This is part of my function:
volx = interp1([stor(i, 1); inf], [v; 0], x, 'linear', 1);
Thanks a lot

답변 (3개)

Jan
Jan 2015년 4월 16일
The error message seems to be fair: How can the X-value of a signal equal Inf? It is meaningless to set the corresponding Y-value to zero. What do you expect as output value apart from the point stor(i)?

Star Strider
Star Strider 2015년 4월 16일
There is not enough information to be certain (and I don’t have access to R2012 on this machine), but it looks as though you want to extrapolate. The problem is that you are only dealing with a single scalar value in ‘stor’ (and possibly also ‘v’), so that will be a problem. Be sure ‘stor’ and ‘v’ are vectors of the same size, or your interpolation/extrapolation will fail.
Assuming that ‘x’ includes the value you want to extrapolate (that it is one element longer than ‘stor’ and ‘v’), use the 'extrap' option:
volx = interp1(stor(:, 1), v, x, 'linear', 'extrap');
See if that works.
  댓글 수: 1
Star Strider
Star Strider 2015년 4월 17일
@Vittoria — I do not understand the problem you want to solve. Please post some representative data, a detailed description of the problem, and what you want to do.

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


Vittoria D'Avino
Vittoria D'Avino 2015년 4월 17일
Thanks a lot. I tried but I have the same problem :-( I try to explain the problem below:
Stor is a vector of 2 coloumn and finite number of rows (dose and volume for each patient 'i') x vector is shorter than raw dimension of 'stor' because my problem is that 'stor' have not the exact values of volume at fixed dose value.
I tried to substitute inf with 1 and I solved
volx = interp1([stor(i, 1); inf], [v; 0], x, 'linear', 1);
volx = interp1([stor(i, 1); 1], [v; 0], x, 'linear', 1);
In a second and similar function the problem is inverse: I have to extrapolate the value of dose at fixed value of volume but the similar solution is wrong...uff
dosex = interp1([v; inf], [stor(i, 1); 0], x, 'linear', MaxD(ddbsi));
I hope to be clear and sintetic.
Thanks a lot
  댓글 수: 1
John D'Errico
John D'Errico 2015년 4월 17일
Please don't add answers for every comment that you make. There is a button to add a comment to any answer, or to your own question.

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by