From: IAV Michel on
Hi, I want to interpolate a point using interp2. Here is my M file:
V=2361100000;
for i=1:70
A=M(i,:);
for j=1:12
AA=A(j);
L(j)=interp2(QQ,SS,RR,AA,V,'linear',extrapval);
V=V+AA-L(j);
end;
LL(i,:)=L;
end
It returns ?? Undefined function or variable 'extrapval'.
Please, can somebody help me?
From: Andy on
"IAV Michel" <martcoul70(a)yahoo.fr> wrote in message <i224r0$9os$1(a)fred.mathworks.com>...
> Hi, I want to interpolate a point using interp2. Here is my M file:
> V=2361100000;
> for i=1:70
> A=M(i,:);
> for j=1:12
> AA=A(j);
> L(j)=interp2(QQ,SS,RR,AA,V,'linear',extrapval);
> V=V+AA-L(j);
> end;
> LL(i,:)=L;
> end
> It returns ?? Undefined function or variable 'extrapval'.
> Please, can somebody help me?

It's a pretty clear error message. Did you define a variable or function called extrapval? And did you read the documentation for interp2 to see what extrapval is intended to be?
From: someone on
"Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i225do$gnh$1(a)fred.mathworks.com>...
> "IAV Michel" <martcoul70(a)yahoo.fr> wrote in message <i224r0$9os$1(a)fred.mathworks.com>...
> > Hi, I want to interpolate a point using interp2. Here is my M file:
> > V=2361100000;
> > for i=1:70
> > A=M(i,:);
> > for j=1:12
> > AA=A(j);
> > L(j)=interp2(QQ,SS,RR,AA,V,'linear',extrapval);
> > V=V+AA-L(j);
> > end;
> > LL(i,:)=L;
> > end
> > It returns ?? Undefined function or variable 'extrapval'.
> > Please, can somebody help me?
>
> It's a pretty clear error message. Did you define a variable or function called extrapval? And did you read the documentation for interp2 to see what extrapval is intended to be?

In all fairness to the OP the documentation for the extrapval option of interp2 is a bit obtuse. I read the help for interp2 quite a few times and still wasn't sure what it was saying about extrapval. From what I finally found on the MATLAB support web site (doing a search for interp2 & extrapval) for iterp1:

If any element of xi is outside the interval spanned by x, the specified interpolation method is used for extrapolation. Alternatively, yi = interp1(x,Y,xi,method,extrapval) replaces extrapolated values with extrapval. NaN is often used for extrapval.

I assume it works the same for interp2, that is, you supply a scalar value for extrapval. Then if an extrapolation is needed, the value you supplied is used. Correct?
From: IAV Michel on
"Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i225do$gnh$1(a)fred.mathworks.com>...
> "IAV Michel" <martcoul70(a)yahoo.fr> wrote in message <i224r0$9os$1(a)fred.mathworks.com>...
> > Hi, I want to interpolate a point using interp2. Here is my M file:
> > V=2361100000;
> > for i=1:70
> > A=M(i,:);
> > for j=1:12
> > AA=A(j);
> > L(j)=interp2(QQ,SS,RR,AA,V,'linear',extrapval);
> > V=V+AA-L(j);
> > end;
> > LL(i,:)=L;
> > end
> > It returns ?? Undefined function or variable 'extrapval'.
> > Please, can somebody help me?
>
> It's a pretty clear error message. Did you define a variable or function called extrapval? And did you read the documentation for interp2 to see what extrapval is intended to be?

extrapval is used to extrapolate values that are not spanned by QQ and SS (according to the documentation found here: http://www.mathworks.com/access/helpdesk/help/techdoc/ref/interp2.html
Note that the part dealing with extrapval doesn't exist in my Matlab version help. I don't know why it doesn't work!!
From: Walter Roberson on
IAV Michel wrote:
> "Andy " <myfakeemailaddress(a)gmail.com> wrote in message
> <i225do$gnh$1(a)fred.mathworks.com>...
>> "IAV Michel" <martcoul70(a)yahoo.fr> wrote in message
>> <i224r0$9os$1(a)fred.mathworks.com>...
>> > Hi, I want to interpolate a point using interp2. Here is my M file:
>> > V=2361100000;
>> > for i=1:70
>> > A=M(i,:);
>> > for j=1:12
>> > AA=A(j);
>> > L(j)=interp2(QQ,SS,RR,AA,V,'linear',extrapval);
>> > V=V+AA-L(j);
>> > end;
>> > LL(i,:)=L;
>> > end
>> > It returns ?? Undefined function or variable 'extrapval'.
>> > Please, can somebody help me?
>>
>> It's a pretty clear error message. Did you define a variable or
>> function called extrapval? And did you read the documentation for
>> interp2 to see what extrapval is intended to be?
>
> extrapval is used to extrapolate values that are not spanned by QQ and
> SS (according to the documentation found here:
> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/interp2.html
> Note that the part dealing with extrapval doesn't exist in my Matlab
> version help. I don't know why it doesn't work!!

extrapval is not a keyword: it is a value you need to provide to if you want
out-of-range coordinates to extrapolate to special value (such as inf or nan).