Sigma notation - two variables. 'for' loop or symsum?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Nate
am 20 Okt. 2014
Kommentiert: Roger Stafford
am 22 Okt. 2014
Hello
I am trying to compute a sigma summation of a simple single column vector x, where:
N = length(x)
k = 0:N/4
i = 1:N-k
I need to solve for Axx(k):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/145782/image.jpeg)
I have tried to solve this using 'for' loops and symsum function, without success. Help is hugely appreciated, thanks.
0 Kommentare
Akzeptierte Antwort
Star Strider
am 20 Okt. 2014
This runs:
N = length(x);
for k = 0:N/4
Axx(k+1) = 0;
for i = 1:N-k
Axx(k+1) = Axx(k+1) + x(i)*x(i+k);
end
end
I’ll let you determine if it gives the answers you expect.
2 Kommentare
Weitere Antworten (1)
Roger Stafford
am 21 Okt. 2014
Axx = x.'*hankel(x,zeros(1,N/4+1));
2 Kommentare
Roger Stafford
am 22 Okt. 2014
That's probably because your value N is not a multiple of 4. Do this:
round(N/4)+1
instead.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!