octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Should interp1.m function allow jumps in X-values?


From: Michael D Godfrey
Subject: Re: Should interp1.m function allow jumps in X-values?
Date: Thu, 23 Aug 2012 09:34:32 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0

On 08/23/2012 08:16 AM, Ben Abbott wrote:
	X = [ 2 1 3 2];
>>> 	Y = [ 9 1 3 10]; 
>>> 	% These are right-continuos (returns 10)
>>> 	y1 = interp1 (X, Y, 2)
>>> 	[~, n] = sort (X);
>>> 	y2 = interp1 (X(n), Y(n), 2)
>>> 	[~, n] = sort (X, "descend");
>>> 	y3 = interp1 (X(n), Y(n), 2)
>>> 	y4 = interp1 (X, Y, 2, "-right")
>>> 	% These are left-continuous (returns 9)
>>> 	[~, n] = sort (fliplr (X), "descend");
>>> 	y5 = interp1 (X(n), fliplr(Y)(n), 2)
>>> 	y6 = interp1 (X, Y, 2, "-left")
>>> 
>>> Ben
>>> 
This example would be useful in the Manual!!

Congratulations of figuring this out.

Michael


reply via email to

[Prev in Thread] Current Thread [Next in Thread]