I cannot use "binornd" or "random" function

13 visualizaciones (últimos 30 días)
Hi
I'm writting a code for a homework but I cannot use the "binornd" function to generate random numbers with a binomial distribution. The program shows me the next message: "Undefined function 'binornd' for input arguments of type 'double'." Then, I tried with "random" function and the program shows me "Undefined function 'random' for input arguments of type 'char'." The same situation happened with "makedist" function.
I was reading in this forum and I understood that maybe is a license problem, but I don't know how to fix it (By the way, I renewed my license file yesterday).
Below I write my code. And thanks for any help!
%%%%%Condiciones iniciales
Phi=0.95;
n=50;
P0=1;
x0=sqrt(P0)*randn(1,1);
Q0=0.1;
w0=sqrt(Q0)*randn(1,1);
x(1)=Phi*x0+w0;
%%%%Estado%%%%%%
for k=1:n
Q(k)=0.1;
w(k)=sqrt(Q(k))*randn(1,1);
x(k+1)=Phi*x(k)+w(k);
end
%%%Observaciones
R0=0.5;
p=0.5;
v0=sqrt(R0)*randn(1,1);
g0=binornd(1,p);
z0=g0*x0+v0;
for k=1:n
R(k)=0.5;
v(k)=sqrt(R(k))*randn(1,1);
g(k)=binornd(1,p);
z(k)=g(k)*x(k)+v(k);
end

Respuesta aceptada

Steven Lord
Steven Lord el 5 de Sept. de 2022
Both binornd and random are functions in Statistics and Machine Learning Toolbox. Do you have this toolbox installed and licensed? To check if it is installed use the ver function. From the behavior you described you likely do not have it installed.

Más respuestas (0)

Categorías

Más información sobre Introduction to Installation and Licensing 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