How to calculate mean and standard deviation for loops?
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Sumit Saha
le 11 Juil 2021
Commenté : Sumit Saha
le 11 Juil 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 commentaires
Réponse acceptée
ANKUR KUMAR
le 11 Juil 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)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!