How i can estimate the hurst parameter for a matrix of topographic data?
Show older comments
%%Author: Friedrich Leisch
%%Modified by Alois Schloegl
function H = hurst (x)
if (nargin ~= 1)
fprintf(1,'usage: hurst (x)');
end
if (isscalar (x))
error ('hurst: x must not be a scalar')
elseif (isvector (x))
x = reshape (x, length (x), 1);
end
[xr, xc] = size (x);
x0 = center(x,1);
xr = sum(~isnan(x0));
x0(isnan(x0))=0;
s = sqrt(sum(x0.*x0,1)./max(0,xr-1)); % std
w = cumsum (x0,1);
RS = (max(w) - min(w)) ./ s;
H = log (RS) ./ log (xr);
i found this code but don't works in matlab, it comes from a similar code from Octave
Answers (2)
Walter Roberson
on 12 May 2011
I'm having difficulty finding a reference page for exactly what Octave's center() function is intended to do.
It appears that possibly you could replace
x0 = center(x,1);
by
x0 = bsxfun(@minus,x,mean(x));
1 Comment
Matt Fig
on 12 May 2011
Assuming the CENTER function was not part of a bundle that came with the HURST function...
Matt Fig
on 12 May 2011
0 votes
Would you mind elaborating on what "It doesn't work" means? Does it error? If so, what does the error message say. If not, what is the problem? If it is just completely wrong, why post it?? Did this function come as part of a bundle which included the CENTER function?
2 Comments
Walter Roberson
on 13 May 2011
Octave does have a center() function; I have been able to find an official patch updating it. I just haven't been able to find documentation for it; in particular I am missing information about what the optional parameter 1 means in this situation.
Walter Roberson
on 13 May 2011
In Octave it is statistics/center.m and in general terms it outputs x - E[x] where E[x] denotes the Expected Value of x. But I don't know whether it is intended to be per-column, or if it defaults to the expected value of the entire matrix but the "1" tells it to operate per-column, or if the "1" is acting as a redundant specification that it should act along the first dimension, or ... ?
Categories
Find more on Octave in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!