I cannot use "binornd" or "random" function
3 次查看(过去 30 天)
显示 更早的评论
César Guillermo Rendón Mayorga
2022-9-5
评论: César Guillermo Rendón Mayorga
2022-9-6
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 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!