I cannot use "binornd" or "random" function
6 ビュー (過去 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!