	function trend, x, width

if n_elements(width) le 0 then width=10

x1=median(x,width/2 > 2)
y=x1

for j=0L, n_elements(x)-1 do $
	y(j)=min(x1(j-width/2. > 0: j+width/2.-1 <(n_elements(x)-1)))

return, smooth(y, width)

	end