Formula Mean Values in Matlab code.
Mostrar comentarios más antiguos
Hello, can anyone help to write in Matlab code the formula below. The third term with the minus sine is a double sum.
(sum from i=1 to N of Xt-i*168)/N + (sum from j=1 to 7 of Xt-j*24)/7 -(sum of i=1 to n sum of j=1 to 7 of Xt-i*168-j*24)/(7*N).
thank you for your time
4 comentarios
Azzi Abdelmalek
el 29 de Sept. de 2012
Editada: Azzi Abdelmalek
el 29 de Sept. de 2012
what is Xt? its size?
Azzi Abdelmalek
el 29 de Sept. de 2012
what are your index i or t?
aggelos
el 29 de Sept. de 2012
Respuestas (1)
Image Analyst
el 29 de Sept. de 2012
I don't think you've explained this correctly. What's the difference between t and i? Anyway, here's some code to get you started:
N = 100; % Or whatever. The number of elements.
T = 1 : N;
Xt = 2 * T; % Or whatever function of T that X is.
i = 1 : N;
theFirstSum = sum(Xt - (i * 168) / N)
5 comentarios
aggelos
el 29 de Sept. de 2012
aggelos
el 29 de Sept. de 2012
Image Analyst
el 29 de Sept. de 2012
OK. So, didn't I do that for the first sum? I just had to guess at Xt because you didn't tell us what it was - you replace that line with your actual Xt. Then you just basically do the same for the other sums. After all, it's your assignment so I can't just do everything for you and hand it over to you.
aggelos
el 30 de Sept. de 2012
Image Analyst
el 30 de Sept. de 2012
To sum the prior 168 items, in general
theSum = zeros(1, lastIndex);
for k = 168 : lastIndex
theSum(k) = = sum(Xt((k - 167) : k));
end
Categorías
Más información sobre Debugging and Analysis en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!