Hi,
I have a vector "Xt" where Xt dimensions are 12588 X 1. From this vector I apply this code:
S=sum((abs(Xt(2:end)-Xt(1:end-1))).^2);
which result in one number where S is a 1by1.
Now my objective is to construct a vector S (Nx1) where each value in S depends on J and K — for instance:
S=sum((abs(Xt(j:end)-Xt(k:end-1))).^2);
At first I thought of the following (I don't want J do exceed 126):
for j=2:126 k=1:125, S=sum((abs(Xt(j:end)-Xt(1:end-k))).^2); end;
I got this: "Error using – Matrix dimensions must agree."
Any insight at how I can correct this matrix issue?
Thank you!
Best Answer