How to create a histogram without using the matlab function
이전 댓글 표시
How to create a histogram without using the matlab hist function.
Given scattered data x = randn(1,100); y = randn(1,100);
with coresponding phase p = randn(1,100), having phase phase = exp(1i*p);
would like to create uniform grid, add the phase for the data points that are inside each bin.
This is to create a na intensity plot or coherent sum of the scattered data.
댓글 수: 7
Image Analyst
2020년 2월 28일
편집: Image Analyst
2020년 2월 28일
Why would you want to do that? What's wrong with using the built-in function that you bought along with MATLAB??? Which array (x, y, p, or phase) do you want to take the histogram of? Why not use histogram2()?
Guillaume
2020년 2월 28일
In addition to what has been said, it would be useful to know which 'matlab function' has been banned. There are many matlab functions that can be used to generate histograms: hist, histc, histogram, histcounts, histogram2, histcounts2, accumarray, imhist, probably more...
Image Analyst
2020년 2월 29일
Why not
[counts, edges] = histcounts(phases, numberOfBins);
We're not sure what you want if it's not a count of the number of occurrences of values in certain ranges (bins). That is what a histogram is. How can you say you want a histogram but say you're struggling when the functions count the occurrences? That's what a histogram is.
Guillaume
2020년 3월 1일
@Ole, can you give a formal mathematical definition of what it is you want to calculate for a bin, because as you can see we're a bit confused.
Ole
2020년 3월 1일
채택된 답변
추가 답변 (1개)
Steven Lord
2020년 2월 28일
1 개 추천
Consider using discretize to bin the data then passing that grouping information into groupsummary or splitapply.
카테고리
도움말 센터 및 File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!