<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">Le 10/01/2021 à 08:18, Federico Miyara
a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:ddea38be-bd32-53e9-b5d9-2fd670ce1cc5@fceia.unr.edu.ar">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<br>
<font face="Courier New">Dear All,<br>
<br>
I find that the extrapolation option for interp1 is not
thoroughly documented. In the Arguments section it states, for
extrapolation,</font><br>
<br>
<blockquote>(optional) string, or real value defining the yp(j)
components for xp(j) values outside [x1,xn] interval.<br>
</blockquote>
<br>
In the Description section the only string listed is "extrap"
which says:<br>
<br>
<div class="refsection">
<dl>
<dd>
<p class="para"> the extrapolation is performed by the
defined method </p>
</dd>
</dl>
</div>
<font face="Courier New"><br>
But which is the defined method? </font></blockquote>
<p><font face="Courier New"><method>, used for interpolation.</font></p>
<p><font face="Courier New"><br>
</font></p>
<blockquote type="cite"
cite="mid:ddea38be-bd32-53e9-b5d9-2fd670ce1cc5@fceia.unr.edu.ar"><font
face="Courier New">If one selects the method "spline" it is
suggested to refer to interp(), which has a specific argument
(called out_mode) with several possibilities for extrapolation.
These possibilities aren't accessible from the interp1()
function, so it should be completely clear in its documantation
which one is used.<br>
</font></blockquote>
<p><br>
</p>
<p><font face="Courier New">Right. This is true also for interp(),
for which the default extrapolation behavior is not documented.<br>
</font></p>
<p><font face="Courier New"></font><br>
</p>
<blockquote type="cite"
cite="mid:ddea38be-bd32-53e9-b5d9-2fd670ce1cc5@fceia.unr.edu.ar"><font
face="Courier New"> <br>
Besides, the argument extrapolation is optional but it is not
clear what happens if it is not used. I suppose it is what
appears under "by default",</font></blockquote>
<p><br>
</p>
<p><font face="Courier New">Sure</font></p>
<p><font face="Courier New"></font><br>
</p>
<blockquote type="cite"
cite="mid:ddea38be-bd32-53e9-b5d9-2fd670ce1cc5@fceia.unr.edu.ar"><font
face="Courier New"> but again it says<br>
<br>
</font><font face="Courier New"> </font>
<div class="refsection">
<dl>
<dd>
<p class="para"> the extrapolation is performed by the
defined method (for spline method) </p>
</dd>
</dl>
</div>
<br>
But, as already mentioned, tha spline method has <font
face="Courier New">more than one extrapolation strategy, which
can be selected from interp but not from interp1.<br>
</font></blockquote>
<p><br>
</p>
<p><font face="Courier New">It is the same remark as above.<br>
</font><font face="Courier New"></font><br>
</p>
<blockquote type="cite"
cite="mid:ddea38be-bd32-53e9-b5d9-2fd670ce1cc5@fceia.unr.edu.ar"><font
face="Courier New"> Finally, at least for spline it seems to be
no difference between setting the extrapolation argument to
"extrap" or not using it.<br>
</font></blockquote>
<p>According to the current documentation,</p>
<p><font size="+1" face="monospace">interp1(x, y, xp, "spline",
"extrap") // is equivalent to<br>
interp1(x, y, xp, "spline", "spline")<br>
</font><br>
// while<br>
<font size="+1"><br>
interp1(x, y, xp, "spline") // is as well equivalent to<br>
interp1(x, y, xp, "spline", "spline")<br>
</font></p>
<p>So yes, same results are expected.<br>
</p>
<p>But i find as well the "by default" explanation uselessly
complicated: From<br>
<i> by default :</i><i><br>
</i><i> the extrapolation is performed by the defined method
(for spline method), and by nan for</i><i><br>
</i><i> linear and nearest methods.
yp=interp1(x,y,xp,method)</i><i><br>
</i>it could rather be something like<br>
<i> by default :</i><i><br>
</i><i> the extrapolation is performed by spline when the
interpolation is done by spline, and by nan for</i><i><br>
</i><i> linear and nearest interpolation methods.</i><i><br>
<br>
</i>Samuel Gougeon<br>
</p>
<p><i><br>
</i></p>
</body>
</html>