histogram of x and y data from a txt file
10 ビュー (過去 30 日間)
古いコメントを表示
Hi guys!
The attached txt file contains the infromation of mesh quality generated in a CAD model. The 1st column represents the "skewness" and the 2nd column represents the "number of elements". How i can plot the histogram of the data, in which the x axis shows the skewness and y axis shows the number of elements, like the attached figure?
Thank you
Masoud
0 件のコメント
採用された回答
Star Strider
2021 年 11 月 29 日
It seems to produce the correct result on its own!
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/817474/mesh_histogram.txt', 'VariableNamingRule','preserve')
figure
plot(T1{:,1}, T1{:,2})
Adjust the available options to produce the desired result.
Another possibility —
figure
fill(T1{:,1}, T1{:,2}, 'r')
Experiment to get the desired result.
.
2 件のコメント
その他の回答 (1 件)
Image Analyst
2021 年 11 月 29 日
Looks like Star's answer is what you're looking for. I just wanted to say that skewness is the third central moment of a distribution (histogram), so that histogram you have will also have a skewness related to how lopsided/skewed the distribution is. A symmetrical distribution (e.g. a Normally distributed population) would have a skewness of 0. If it's skewed left it would have a negative skewness and if it's skewed right it would have a positive skewness.
I've heard of the skewness of a histogram but I've never heard of a histogram of skewnesses, though it's possible. For example you could read in 400 images and compute the distance between an actual (x,y,z) coordinate on the 3-D printed (or blow molded) physical object, and the desired (x,y,z) coordinate of the CAD model, and then get a histogram of the distances and compute the skewness of the disance errors for each image (CAD file) (based on it's histogram), then you could get a distribution of those skewnesses (over all CAD files), where the bin value is the skewness and the y value is the count.
What's puzzling me is that none of your skewnesses are more than 1, or less than 0. I mean, I guess it could happen, like if your distributions were just very slightly lopsided to the right, though the huge spikes near (but not exactly at) 1 are also puzzling.
So I just wanted to make sure that you're getting your skewnesses correct and you really have a distribution of skewnesses and not some other type of distribution, like distribution of gray levels, or particle sizes, or distance deviations between physical model and CAD model, or whatever.
2 件のコメント
Image Analyst
2021 年 11 月 29 日
Seems to me "perfect" would be if the cellsize was the optimalcellsize so the numerator was 0 and the skew value would be 0, not 1. If the cell size was 0, it seems like that would be bad and the skew would be 1, and if the cell size was huge, like 2*optimalcellsize, then the skew would be -1. So it seems like a histogram might have a hump centered around zero if most of the cell sizes were near optimal.
参考
カテゴリ
Help Center および File Exchange で Histograms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!