To integrate histogram bins

22 ビュー (過去 30 日間)
Pouyan Msgn
Pouyan Msgn 2020 年 8 月 16 日
コメント済み: Image Analyst 2020 年 8 月 16 日
Hi ! I have 2 files where I have first to create histogram and then find the integrated value of some bins!
clc
clear all
D1=importdata('M1.txt');
t1=D1(:,1); A1=D1(:,2);
D=importdata('M2.txt');
t=D(:,1); A=D(:,2);
Af=[A1
A];
h=histogram(Af,130)
I want integrated values from 0 to 0.05, 0.05 to 0.1 and from 0.1 to 0.15 !
But I dont know how to do this!

回答 (1 件)

Image Analyst
Image Analyst 2020 年 8 月 16 日
Your bin edges don't match up exactly with those numbers so there will be data in the starting and ending bins that are outside of the range you want. Therefore you can't do it from the histogram directly. You must count the values of Af that lie in the range. Here is how you do it:
count1 = sum(Af >= 0 & Af <= 0.05)
count2 = sum(Af >= 0.05 & Af <= 0.1)
count3 = sum(Af >= 0.1 & Af <= 0.15)
  2 件のコメント
Pouyan Msgn
Pouyan Msgn 2020 年 8 月 16 日
Thank you!
And is that possible to integrate within these ranges?
Image Analyst
Image Analyst 2020 年 8 月 16 日
Of course, you can use the same concept to go between any two numbers.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeHistograms についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by