I cannot use "binornd" or "random" function
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
César Guillermo Rendón Mayorga
le 5 Sep 2022
Commenté : César Guillermo Rendón Mayorga
le 6 Sep 2022
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
0 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!