Multiple summations in one formula
Mostrar comentarios más antiguos

Hi all,
I'm not very good at matlab and trying incorporate the above formula. I'm trying to do part (2) and (3) first, to get them more easily in the complete formula.
I am struggling with (3): Y is in my case a 101x14 matrix and I think the mean should then be one number. I can obviously take the mean of the columns and rows seperately, yielding a 101x1 and a 14x1 vector, but these are obvousily not compatible for matrix multiplication.
Any advice on how to make this work better?
Additionally, am I correct doing the following instead of symsum?
M = 1; % Test day
N = 14; % Number of runs (or repetitions)
T = 101; % Number of time points
for n = 1:N
for t = 1:T
R2 = ....
end
end
Many thanks in advance!
Respuesta aceptada
Más respuestas (1)
darova
el 10 de Sept. de 2019
Shorter version
clc,clear
Yit = repmat( mean(Yijt,2), [1 N 1] ); % get mean and make 3D matrix
Yi = mean(mean(Yijt,2),3); % get mean 2d and 3d dimensions
Yi = repmat( Yi, [1 N T] ); % make 3D matrix
upsum = (Yijt-Yit).^2;
botsum = (Yijt-Yi).^2;
R2a = 1 - sum(upsum(:))/sum(botsum(:)) * T*(N-1)/(N*T-1);
1 comentario
Inti Vanmechelen
el 10 de Sept. de 2019
Categorías
Más información sobre Logical 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!