Find correlation coefficient of every nth row
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
David du Preez
el 13 de Abr. de 2017
Respondida: Andrei Bobrov
el 13 de Abr. de 2017
I have two 121x14 matrices. I want to find the correlation coefficient of column 8 in each matrix. So I have made two matrices with only the data that I want to correlate. Using:
UVI_am = CP_ALL_W_am(:,8);
UVI_pm = CP_ALL_W_pm(:,8);
Now I want to correlate every 11 rows and save the correlation coefficient to different output array. I know you can correlate using:
R=corr(UVI_am,UVI_pm);
but how does one limit to every 11 rows and repeat it.
0 comentarios
Respuesta aceptada
Andrei Bobrov
el 13 de Abr. de 2017
UVI_am = reshape(CP_ALL_W_am(:,8),11,[]);
UVI_pm = reshape(CP_ALL_W_pm(:,8),11,[]);
R = arrayfun(@(ii)corr(UVI_am(:,ii),UVI_pm(:,ii)),(1:11)');
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!