Using normpdf with datetime datatype
Mostrar comentarios más antiguos
I have a vector of time in datetime datatype. I would like to calculate the Normal pdf by giving arguments in datetime datype. normpdf does not work with datetime arguments, but it works if I convert the arguments to datenum
Non-scalar arguments must match in size.
Consider the following-
today = datenum('21-Aug-2019');
xs = datestr((today-5):(today+5));
x = datetime(xs);
mu = datetime(datestr(today));
stdev = hours(20);
The following does not work-
weight = normpdf(x, mu, stdev)
but the following works-
weight = normpdf(datenum(x), datenum(mu), datenum(stdev))
Just want to check, if it is possible to make normpdf with datetime.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Time Series Objects en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!