help-octave
[Top][All Lists]
Advanced

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

Re: detrend() in Matlab and Octave


From: H W Borchers
Subject: Re: detrend() in Matlab and Octave
Date: Thu, 23 Dec 2010 14:57:09 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Martin Helm <martin <at> mhelm.de> writes:
> 
> Am Donnerstag, 23. Dezember 2010, 08:15:06 schrieb H W Borchers:
> > There is. A call like
> > 
> >     x = (1:5).^2;
> >     detrend(x, 2)
> > 
> > will return the result [0 0 0 0 0] in Octave and [2 -1 -2 -1 2] in Matlab
> > (with a warning).
> 
> detrend(x, 2) is as far as I understand the ML documentation no valid syntax, 
> since ML cannot remove a quadratic trend therefor the ML result cannot be the 
> same since it only removes a linear trend from a quadratic input while octave 
> removes a quadratic trend from a quadratic input and gives you the correct 
> answer [0 0 0 0 0].
> detrend (x, 1)
> ans =
> 
>    2.0000  -1.0000  -2.0000  -1.0000   2.0000
> 
> gives correctly the same as ML detrend (c, 'linear') or detrend(x).
> 

That's true.
Now, if some Octave code uses "detrend(x, 2)" to remove a quadratic trend,
this piece of code will become invalid if we go back to the Matlab version
--- because Matlab's version never removes a trend of higher order.

I never said this is good or bad, I was just interested to know whether
there is a special reason to deviate in this way. Maybe it was different
in older versions of Matlab?

Hans Werner







reply via email to

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