Belinda Kellerer
unread,May 18, 2017, 4:45:10 AM5/18/17You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hello,
I want to solve the following equation using fsolve:
fun = @(w)[w(1)-((max(1-sqrt(aa)/(sqrt((meanA-gwb*w(2))'*waTeil*(meanA-gwb*w(2)))),0))*waTeil*(meanA-gwb*w(2)));...
w(2)-((max(1-sqrt(ab)/(sqrt((meanB-hwa*w(1))'*wbTeil*(meanB-hwa*w(1)))),0))*wbTeil*(meanB-hwa*w(1)))];
x0WA = zeros(8,1);
x0WB = 0;
opt = optimset('Display','off');
weights = fsolve(fun,[x0WA; x0WB]);
where aa,ab, wbTeil are scalars
meanA, gwb are 8x1 vectors
hwa is a 1x8 vector
waTeil is a 8x8 matrix
Is it possible to solve the equation?
I get the following error:
Error using /
Matrix dimensions must agree.
Error in
AAparameterAndModelUncertainty>@(w)[w(1)-((max(1-sqrt(aa)/(sqrt((meanA-gwb*w(2))'*waTeil*(meanA-gwb*w(2)))),0))*waTeil*(meanA-gwb*w(2)));w(2)-((max(1-sqrt(ab)/(sqrt((meanB-hwa*w(1))'*wbTeil*(meanB-hwa*w(1)))),0))*wbTeil*(meanB-hwa*w(1)))]
(line 72)
w(2)-((max(1-sqrt(ab)/(sqrt((meanB-hwa*w(1))'*wbTeil*(meanB-hwa*w(1)))),0))*wbTeil2*(meanB-hwa*w(1)))];
Error in fsolve (line 230)
fuser = feval(funfcn{3},x,varargin{:});
Error in AAparameterAndModelUncertainty (line 76)
weights = fsolve(fun,[x0WA; x0WB]);
Caused by:
Failure in initial objective function evaluation. FSOLVE cannot continue.
I made sure that the matrix dimensions agree, so I am wondering if the error is caused by the fact that w(1) is a vector and w(2) is a scalar.
Thanks for your help