Error Histfit too many arguments

조회 수: 4 (최근 30일)
desert_scientist90
desert_scientist90 2019년 10월 2일
답변: Siriniharika Katukam 2019년 10월 10일
Hi I am trying to overlay a normal distribution and a gamma distribution in the same histogram. I am using the following code which give me a error message because I am using too many arguments under histfit. I tried to use the distribution fitter but my Y axis is density and I need frequency instead. Is there anyway to work around this?
Thanks in advance for your help
number_of_bins = 10;
histfit(rain1positive, 10,'gamma','normal');
xlabel('mm');
title('station 1 jja');
umber_of_bins = 10;
histfit(rain1, 10,'gamma');
xlabel('mm');
title('station 1 jja');
  댓글 수: 2
Adam Danz
Adam Danz 2019년 10월 2일
histfit() has 1 required input and 2 more optional inputs. It does not have any name-value parameter options. The 3rd input specifies the distribution. Your 4th input, 'normal' is causing the problem. The distribution will be normal if the data produce a normal distribution so maybe I'm missing the point of this 'normal' input.
desert_scientist90
desert_scientist90 2019년 10월 2일
I'm trying to display both curves within the same histogram.

댓글을 달려면 로그인하십시오.

답변 (1개)

Siriniharika Katukam
Siriniharika Katukam 2019년 10월 10일
Hi
To display both curves in same histogram, try using below command after gamma distribution using "histfit":
hold on;
and then use “histfit” with normal distribution. This way you can display both the histograms in same figure.

Community Treasure Hunt

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

Start Hunting!

Translated by