Bug in normpdf function

16 visualizaciones (últimos 30 días)
charles sutton
charles sutton el 16 de Ag. de 2016
Comentada: charles sutton el 16 de Ag. de 2016
Hi all,
I have encountered a weird issue using normpdf function for small sigma values, The code aims to create a dataset of "gaussian pulses" (different mu but same sigma)
sigma = 0.001 ; % constant sigma
D = 100 ; % Dimension of 1 pulse
I = linspace(0,1,D);% Interval
n = 30 ; % number of pulse
pulse_dataset = zeros(n,D); %initializing the dataset
for i = 1:n
mu = rand(); %generate random mu in intervall [0,1]
pulse_dataset(i,:) = normpdf(I, mu, sigma);
end
figure;
for i=1:n
plot(I,pulse_dataset(i,:));
hold on
end
This code outputs :
Since sigma is constant, why the pulses have not the same shape ?
Thanks for you help,

Respuesta aceptada

Torsten
Torsten el 16 de Ag. de 2016
The height of the peaks depends on how small min(I-mu) is. Choosing D->Inf (e.g. D=10000), the shape of the pulses should become similar.
Best wishes
Torsten.
  1 comentario
charles sutton
charles sutton el 16 de Ag. de 2016
Thank you Torsten, Your suggestion works.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by