範囲を指定してヒストグラムからaverage, variance, skewnessの算出
Ältere Kommentare anzeigen
以下のプログラムで複数のテキストデータを読み込み、countsでヒストグラムを作り、average, variance, skewnessをそれぞれ算出するようにしたのですが、データにはエラーが含まれておりそのエラーだけ範囲指定をして除くなど、何か方法ありましたら教えていただけると幸いです。
nbins = 150;
total_counts = zeros(1,nbins);
for i = 1:31
if i<10
daystr = ['0', num2str(i)];
else
daystr = num2str(i);
end
for k = 0:7
j = 3*k;
if j<10
hour = ['0', num2str(j)];
else
hour = num2str(j);
end
filename = ['TS2004.07.',daystr,'.',hour,'00.txt'];
x = load(filename);
[counts,edges] = histcounts(x,nbins, 'Normalization', 'pdf');
total_counts = total_counts + counts;
end
end
center = (edges(1:end-1)+edges(2:end))/2;
bar(center,total_counts,1);
xlim([200 350]);
M = mean(x);
V = var(x);
S = skewness(x);
データのエラーは下の図のように-1000が明らかなエラーとなっていますので0以下を切ってそれぞれの値を出せればと考えております。
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Introduction to Installation and Licensing finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!