From: IAV Michel on
"someone" <someone(a)somewhere.net> wrote in message <i226j8$tg$1(a)fred.mathworks.com>...
> "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?

Right! but when i supply a scalar value, it returns too many input arguments
From: IAV Michel on
Walter Roberson <roberson(a)hushmail.com> wrote in message <i227m4$dmk$3(a)canopus.cc.umanitoba.ca>...
> 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).

OK!! Thanks!! When I provide a special value, it returns error using interp2 too many input arguments
From: Andy on
> Note that the part dealing with extrapval doesn't exist in my Matlab version help. I don't know why it doesn't work!!

In addition to Walter's response, the above quote sounds like this particular functionality of interp2 is not available for your MATLAB version. What version do you have?
From: Walter Roberson on
IAV Michel wrote:

>> > > L(j)=interp2(QQ,SS,RR,AA,V,'linear',extrapval);

> Right! but when i supply a scalar value, it returns too many input
> arguments

In one of the postings you indicated that it is not described in your online
help documentation for interp2. It could be that the option is not supported
in your version. Which release are you using? interp2 is a .m source file so
you should be able to examine it to determine whether the code does indeed
support the option.
From: someone on
"IAV Michel" <martcoul70(a)yahoo.fr> wrote in message <i22860$d8f$1(a)fred.mathworks.com>...
> "someone" <someone(a)somewhere.net> wrote in message <i226j8$tg$1(a)fred.mathworks.com>...
> > "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?
>
> Right! but when i supply a scalar value, it returns too many input arguments

Did you "overwrite" interp2 with your own function?

which interp2

Does the above return the MATLAB function (on the MATLAB path)?

What version of MATLAB are you using? (Maybe an older version doesn't support that option.)