fit data to distribution issue

1 visualización (últimos 30 días)
Mustafa Al-Nasser
Mustafa Al-Nasser el 28 de Jul. de 2020
Respondida: Raunak Gupta el 6 de Ag. de 2020
Dear All;
I am trying to fit data to a normal distribution and plot pdf but pdf plot shows several lines , i do not know why it is coming , could you help.
figure is attached
  5 comentarios
Turlough Hughes
Turlough Hughes el 28 de Jul. de 2020
Can you provide the data also so we can replicate what you have done, ie the variable input
Mustafa Al-Nasser
Mustafa Al-Nasser el 28 de Jul. de 2020
I extracted the related data part
Many thanks

Iniciar sesión para comentar.

Respuestas (1)

Raunak Gupta
Raunak Gupta el 6 de Ag. de 2020
Hi,
From the code and data provided on question and comment, I see that the output you are plotting is not in sorted order. So basically, what you are currently seeing is the connected line between all the data points which is going in the direction of how the points are arranged in the input vector. For seeing a continuous line either you can sort both the input1 and y1 before plotting (And similarly for other two pairs) or instead of line you can plot circles for every datapoint. This will give correct visualization. Both approaches can be done like below:
% Sorting the input1 and y1 simultaneously
[input1sorted, ind] = sort(input1);
y1sorted = y1(ind);
plot(input1sorted, y1sorted,'LineWidth',2);
% plotting only dot for each datapoints
plot(input1,y1,'o');

Categorías

Más información sobre Get Started with Curve Fitting Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by