Can anyone debug the following code?

1 visualización (últimos 30 días)
Jab
Jab el 12 de Ag. de 2016
Comentada: Jab el 12 de Ag. de 2016
The code is given below. The problem I am facing is while bringing two plots together using hold on function the result is not the exact result what I am getting in the seperate window. variable K is attached. Thanks
figure,histogram(K);hold on;
pd= fitdist(K','Kernel');
x_values = -30:0.1:40;
y = pdf(pd,x_values);
plot(x_values,y,'LineWidth',2)

Respuesta aceptada

Bekay.Kang
Bekay.Kang el 12 de Ag. de 2016
becuase two plots have different y-axis scale! you have to modify y-axis scale!
%code
figure,hist(K);hold on;
pd= fitdist(K','Kernel');
x_values = -30:0.1:40;
y = pdf(pd,x_values);
plot(x_values,y*(max(hist(K))/max(y)),'r','LineWidth',2)
  1 comentario
Jab
Jab el 12 de Ag. de 2016
thanks for your answer. However my original histogram shrinks.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graphics Object Programming 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