How to calculate mean and standard deviation for loops?
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sumit Saha
el 11 de Jul. de 2021
Comentada: Sumit Saha
el 11 de Jul. de 2021
story_Acc_FN_UL0_S1_5 = randn(1,10);
story_Acc_FN_UL0_S2_5 = randn(1,10);
story_Acc_FN_UL0_S3_5 = randn(1,10);
story_Acc_FN_UL0_S4_5 = randn(1,10);
story_Acc_FN_UL0_S5_5 = randn(1,10);
for uu = 1:10
story_Acc_FN_UL0_R_rup_5(1,uu) = mean(story_Acc_FN_UL0_S1_5(1,uu),story_Acc_FN_UL0_S2_5(1,uu),story_Acc_FN_UL0_S3_5(1,uu),story_Acc_FN_UL0_S4_5(1,uu),story_Acc_FN_UL0_S5_5(1,uu));
std_dvt(1,uu) = std(story_Acc_FN_UL0_S1_5(1,uu),story_Acc_FN_UL0_S2_5(1,uu),story_Acc_FN_UL0_S3_5(1,uu),story_Acc_FN_UL0_S4_5(1,uu),story_Acc_FN_UL0_S5_5(1,uu));
end
0 comentarios
Respuesta aceptada
ANKUR KUMAR
el 11 de Jul. de 2021
You don't need to use loop for that. You can use cat command to concatenate, and then use mean and std functions to the matrix itself.
story_Acc_FN_UL0_S1_5 = randn(1,10);
story_Acc_FN_UL0_S2_5 = randn(1,10);
story_Acc_FN_UL0_S3_5 = randn(1,10);
story_Acc_FN_UL0_S4_5 = randn(1,10);
story_Acc_FN_UL0_S5_5 = randn(1,10);
matrix=cat(1,story_Acc_FN_UL0_S1_5,story_Acc_FN_UL0_S2_5, story_Acc_FN_UL0_S3_5, story_Acc_FN_UL0_S4_5, story_Acc_FN_UL0_S5_5)
meanvalue=mean(matrix)
stdev=std(matrix)
Más respuestas (0)
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!