フィルターのクリア

how use the for loop and stem function

1 回表示 (過去 30 日間)
Alexandre Williot
Alexandre Williot 2015 年 3 月 8 日
回答済み: Alexandre Williot 2015 年 4 月 17 日
Hello, I have a matrix with 3 columns (# of subjects, # of trials, scores). I have 10 subjects (with sometimes the value 999 as score). I need to calculate, for each subject, the mean score and the standard deviation without the value 999. Then, I need to trace the curve of the means for each subjects with the "stem" function. Finally, I have to trace the curve of standard deviation for each subject. I have no idea to do that. Can you help me please.

採用された回答

Alexandre Williot
Alexandre Williot 2015 年 4 月 17 日
clc; clear all; close all;
%-- extraction des données du fichier xlsx -------------------------
[num,txt,raw] = xlsread('C:\Users\alexandre\Dropbox\UQTR 2013 - 2015\Matlab\MatLab EPK6064\Data_Level4_Exo3.xlsx');
%--création matrice Mat---------------------------------------------
Sujets = num(:,1);
Essais = num(:,2);
Scores = num(:,3);
Mat = [Sujets Essais Scores];
%-- RECHERCHE <20 ---------------------------------------------------------
pos_999 = [];
pos_999 = find(Mat(:,3)<20);
Mat(pos_999,3)= 999;
%-- Moyenne ---------------------------------------------------------------
for n=1:10
pos_suj = []
pos_suj = find(Mat(:,1) == n)
Mat_suj = []
Mat_suj = Mat(pos_suj,3)
pos_int = []
pos_int = find (Mat_suj~=999)
Mat_val=[]
Mat_val= Mat_suj(pos_int,1)
M_Mean(n,1) = mean (Mat_val)
M_std (n,1) = std (Mat_val)
end
%--graphique---------------------------------------------------------------
figure(1)
stem(M_Mean)
xlabel('sujet')
ylabel('moyenne')
title('graphique des moyennes')
figure(2)
stem(M_std)
xlabel('sujet')
ylabel('écart-type')
title('graphique des écart-types')

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by