Syntax Error: Unknown Function
이전 댓글 표시
Hi, for the following code:
n = 50000;
g = 0.3;
x = [];
for i=1:n
k = 0;
while unifrnd(0,1) < g
k = k + 1;
end
b = 0;
mynumber = 2;
for j = 1:k
switch mynumber
case 1
v = random(beta,3,3)
case 2
v = random(gam,5,5)
case 3
v = random(exp,3)
case 4
v = random(geo,0.2)
case 5
v = random(unif,0,5)
case 6
v = random(norm,0,1)
end
b = b + v;
end
if b ~= 0
x = [x, b];
end
end
I get the following error: Undefined function or variable 'gam'.
Error in test (line 21) v = random(gam,5,5)
why is that? Thanks
채택된 답변
추가 답변 (1개)
Muruganandham Subramanian
2013년 5월 29일
0 개 추천
댓글 수: 3
MiauMiau
2013년 5월 29일
Muruganandham Subramanian
2013년 5월 29일
see, You hav to declare the variable 'gam' and others as global or local, then only you can call it..
MiauMiau
2013년 5월 29일
카테고리
도움말 센터 및 File Exchange에서 Psychology에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!