MATLAB: How do you solve for a double sum

matlab codersum

Dear everyone:
I was obsessed with a problem for a long time,here is my equation and date.txt.
My calculation result is quite different from the result in the literature. There must be a problem in my code but I don't know what happened. I'm a newbie, somebody please help me. thanks a lot advance!
clear;
format long g
z=load('d:\20191106\a\a1.txt');
n=length(z);
h=0;
i=0.0195314;
m=100
for m=1:512
for j=1:n
for i=1:n-m
h=h+(z(i+m,j)-z(i,j))^2;
end
end
h=1/(n*(n-m))*h;
rr(m)=log(m*i);
hh(m)=log(h);
end
plot(rr,hh,'bo')
My calculations
literatures

Best Answer

There are some things that are vgue, like the x-axis, in any case, this code shows something similar to the desired result
clear variables, close all;
z=load('a1.txt');
N = size(z,2);
mMax = size(z,1)-1;
H = zeros(mMax,1);
for m = 1:mMax
for j = 1:N
for i = 1:N-m
H(m) = H(m)+(z(i+m,j)-z(i,j))^2;
end
end
H(m) = 1/(N*(N-m))*H(m);
end
figure,semilogx(1:mMax,log10(H),'bo')