Too many input error when generating random number using exponential distribution
Ältere Kommentare anzeigen
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:

I also try some other distributions, but the command "random" ONLY works with normal distribution.
Please help, thank you!
4 Kommentare
Interesting. There is nothing wrong with the code you have written, as I don't get the same error message. I also runs for me in R2022a without error.
pd = makedist('Exponential','mu',0.1);
Y=random(pd,1000,1);
plot(Y)
Please share the result of this command
which random -all
Dyuman Joshi
am 14 Nov. 2023
@Cris LaPierre, shouldn't we check for the result of
which exprnd -all
given the error message produced.
Please also show the output of:
which -all exprnd
欣元
am 14 Nov. 2023
Akzeptierte Antwort
Weitere Antworten (2)
Cris LaPierre
am 14 Nov. 2023
2 Stimmen
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)
1 Kommentar
欣元
am 15 Nov. 2023
欣元
am 15 Nov. 2023
0 Stimmen
Kategorien
Mehr zu Programming finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


