Assign width of Bin Edges within rainflow matrix c = rainflow(x)
25 次查看(过去 30 天)
显示 更早的评论
Is it possible to specify the width of Bin Edges when calculating the rainflow cycle counts matrix c = rainflow(x) ?
After computing the cycle counts for the data, using the command: [c,hist,edges,rmm,idx] = rainflow(Y) , I plot a histogram of cycle counts as a function of stress range, using the command: histogram('BinEdges',edges','BinCounts',sum(hist,2)) , as indicated in the example of the Matlab Documentation
It seems that the 'Bin Edges' are assigned an arbitrary width value. Instead, I would like to assign a specific width value to the Bin Edges, while ploting the histogram of the cycle counts, resulting from the cycle counts matrix 'c = rainflow(x)'.
How can we specify the width of Bin Edges when calculating the rainflow cycle counts matrix 'c = rainflow(x)' ?
Thank you very much in advance for your help
回答(1 个)
Steven Lord
2019-6-25
As written, the BinWidth property of the histogram object is determined by the BinEdges that you specified when you called histogram.
x = randn(1, 1e5);
E = [-3 -2 -1.25 -0.5 0 0.5 1.25 2 3];
h = histogram(x, 'BinEdges', E);
h.BinWidth
oldEdges = h.BinEdges
To change the BinWidth before the fact, change your BinEdges. To change the BinWidth after the fact, set it. This will affect the BinEdges property.
h.BinWidth = 1;
newEdges = h.BinEdges
5 个评论
Nandar Hlaing
2021-2-16
@Max Rose Thank you very much. It is really helpful.
I just have an additional curosity. If I don't want to have the same binwidth for all bins, it is still okay if I directly define edgesx as I prefer right?
Max Rose
2021-2-17
I didn't try by myself but actually thats what is done in:
n_edges=101;
binWidth=0.01;
for i=1:n_edges
edgesx(1,i)=(i-1)*binWidth;
end
There the edges are defined, so I think it should work. So give it a try and let us know.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Vibration Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!