Input argument "" is undefined

4 Ansichten (letzte 30 Tage)
Anita
Anita am 30 Nov. 2011
My problem arises when I run the following piece of code:
theta=[psi;s_u;b];
[theta_to , f_to , cov_to] = maximize(@p_11,theta,2,1,0);
I get this error message:
??? Undefined function or method 'p_11'
for input arguments of type 'double'.
I have made sure that all my functions are in the same library. When I try to call p_ll, I get the following error message:
??? Input argument "theta" is
undefined.
Error in ==> p_ll at 3
psi=theta(1)
The p_ll function looks like this:
function ll=p_ll(theta)
global R N T x y u
psi=theta(1);
s_u=theta(2);
b=theta(3:end);
ll=zeros(N,1);
[S_AR, A]=p_S_AR(T, psi, s_u);
for i=1:N
xb_i=x((i-1)*T+1:i*T,:)*b;
y_i=y((i-1)*T+1:i*T);
ll(i)=log(p_lli(T, R, y_i, xb_i, A, u(:,:,i)));
end
It may be trivial but I cannot find my mistake(s). Does anyone have an idea?

Antworten (1)

Hin Kwan Wong
Hin Kwan Wong am 30 Nov. 2011
function ll=p_ll(theta)
is p_ll with letter L not number ONE
maximize(@p_11,theta,2,1,0);
you put it as p_11 with number ONE
  1 Kommentar
Anita
Anita am 30 Nov. 2011
Thank you! It works now.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Numeric Types finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by