Too many input error when generating random number using exponential distribution
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
欣元
el 14 de Nov. de 2023
Comentada: 欣元
el 15 de Nov. de 2023
Hi everyone,
I want to use command "random" to generate 1000*1 vector, each elements of this vector are random drawn from Exponential distribution whose mu=0.1. This is my code:
pd = makedist('Exponential','mu',0.1);
Y=random(pd,1000,1);
When i run this in MATLAB, there is an error:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1539182/image.png)
I also try some other distributions, but the command "random" ONLY works with normal distribution.
Please help, thank you!
Respuesta aceptada
Steven Lord
el 14 de Nov. de 2023
The exprnd function in D:\dynarc\5.4\matlab\missing\stats\exprnd.m is taking precedence over the exprnd function included in Statistics and Machine Learning Toolbox. That function doesn't have the same signature (doesn't accept the same number and/or type of inputs as the toolbox function.) While it is ahead of the toolbox directory on the MATLAB search path, you will not be able to use the function from the toolbox. I would rename it, remove it, or remove the directory containing it from the MATLAB search path.
Más respuestas (2)
Cris LaPierre
el 14 de Nov. de 2023
You have a function that is shadowing the builtin exprnd.m file. Rename your file (the one at D:\dynarc\5.4\matlab\missing\stats\exprnd.m)
Ver también
Categorías
Más información sobre Logical 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!