Thanks for your fast reply. I cannot run the code now, since my matlab is only installed in my office and I am at home.:(
My matlab version is R2008b 7.7
I guess this is the reason. I should have used YALMIP R2008____ series to be compatible for my matlab version, right?
Another question, is a solver really necessary, if all I need is to use sdpvar and sdpsolve (already in YALMIP I suppose) like in one of the threads earlier on about robust markowitz model.
I quote Lissa"
I' m trying to implement a robust version of the markowitz model, but I have problems and various errors. I think my code is too simple. I tried to rewrite various times, but honestly I don't know what to change anymore.
I hope somebody could take a look at it and give me a hint. Perhaps I'm understanding the way yalmip works wrong,
% Test data
mu_t = [0.05; 0.11; 0.16; 0.25];
Sigma_t = [ 0.025 0.00055 0.0056 0.00125;
0.00055 0.0121 -0.00352 0.011;
0.0056 -0.00352 0.0256 0.012;
0.00125 0.011 0.012 0.0625];
% Calculation of mu for the box contraint
mu_l = mu_t - 0.05*mu_t;
mu_u = mu_t + 0.05*mu_t;
% Calculation of Sigma for the box constraint
Sigma_l = Sigma_t - 0.05*Sigma_t;
Sigma_u = Sigma_t + 0.05*Sigma_t;
n = length(mu_t);
w = sdpvar(n,1);
mu = sdpvar(n,1);
sdpvar t1 t2 t3 t4
Sigma = [t1, Sigma_t(1,2), Sigma_t(1,3), Sigma_t(1,4);
Sigma_t(2,1), t2, Sigma_t(2,3), Sigma_t(2,4);
Sigma_t(3,1), Sigma_t(3,2), t3, Sigma_t(3,4);
Sigma_t(4,1), Sigma_t(4,2), Sigma_t(4,3), t4];
lambda = 0.5;
% constraints on the portfolio
W = [sum(w) == 1, w >= 0];
% Uncertainty set over the return vector - Box Constraint
M = [mu_l <= mu <= mu_u, uncertain(mu)];
% Uncertainty set over the covariance matrix - box constraint
S = [Sigma_l(1,1)<= t1 <= Sigma_u(1,1),
Sigma_l(2,2)<= t2 <= Sigma_u(2,2),
Sigma_l(3,3)<= t3 <= Sigma_u(3,3),
Sigma_l(4,4)<= t4 <= Sigma_u(4,4),
uncertain(t1), uncertain(t2), uncertain(t3), uncertain(t4)];
% objective function
objective = lambda*w'*Sigma*w - mu'*w;
solvesdp(W + S + M, objective)
solution = double(w)
Thanks!
Lissi
"
Thanks for your advice! Sorry that I am really a newbie at this!!