Frequency Magnitude histogram plot
이전 댓글 표시
Hi I have two variabes (Freq and magnitude) I want to plot the histogram so that I get Freq on y axis and magnitude on x-axis.
Please guide
댓글 수: 4
Wayne King
2014년 7월 20일
Can you please attach your data or a picture of what you're trying to get. It's not clear from your question what you want.
Daniel kiracofe
2014년 7월 20일
so, by definition, a "histogram" has counts on the y-axis. i.e. you can only plot a histogram of 1 variable, not 2. Unless I had misunderstood the question.
amberly hadden
2014년 7월 21일
편집: Image Analyst
2014년 7월 21일
답변 (1개)
Kelly Kearney
2014년 7월 21일
Is this what you had in mind?
xedge = 2.1:.1:3;
freq = [43 41 31 29 13 9 3 2 1];
bar(xedge, [freq 0], 'histc')
댓글 수: 4
Image Analyst
2014년 7월 21일
jay's "Answer" moved here since it's not an answer to the original question:
Nope I need binning of data and then to creat a histograme which would be exaclty same as figure I have attached above.
Thank you
Image Analyst
2014년 7월 21일
Well, you have not given your original data. The data you gave is already the "counts" - just as if you have already taken the histogram of some continuous data. What is the original data? What are the numbers in the rang 2.1 - 2.199 that occurred 43 times? And besides, the freq data you gave cannot replicate the shape of the histogram you gave so you can NOT "creat a histograme which would be exaclty same as figure I have attached" .
amberly hadden
2014년 7월 21일
Kelly Kearney
2014년 7월 22일
x = [2.745 2.422 2.876 2.477 2.440 2.674 2.600 2.450 2.630 2.439 ...
2.432 2.483 2.652 2.255 2.448 2.441 2.447 2.537 2.440 2.671 ...
2.502 2.421 2.438 2.582 2.943 2.387 2.221 2.243 2.214 2.187 ...
2.242 2.426 2.385 2.260 2.647 2.595 2.219 2.471 2.495 2.256 ...
2.133 2.225 2.215];
xedge = 2.1:0.1:3;
n = histc(x, xedge);
bar(xedge, n, 'histc');
카테고리
도움말 센터 및 File Exchange에서 Histograms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
