MATLAB Answers


problems about solve exponential function

Asked by xueqi
on 18 Feb 2013

Hi fellows, I have been posted a lot of question for my optimization problem and so far I am still stuck in the place. I think it might be that I haven't explain things precisily. I will try this time.

I have a funciton called beta (which is likely to be an unsmooth one) needed to be optimized. I have tried to use fmincon, and by limit the iterations number to 4 I get a really nice result for once. But the strange thing is that if I run the exactly codes in another computerm it always gives me error message as bellow

>> main

sumllh =


sumllh =


sumllh =


sumllh =


Warning: Explicit solution could not be found. > In solve at 169 In maxmin0 at 142 In maxmin at 15 In beta at 18 In C:\Program Files\MATLAB\R2012a\toolbox\shared\optimlib\finDiffEvalAndChkErr.p>finDiffEvalAndChkErr at 26 In C:\Program Files\MATLAB\R2012a\toolbox\shared\optimlib\finitedifferences.p>finitedifferences at 128 In C:\Program Files\MATLAB\R2012a\toolbox\optim\optim\private\computeFinDiffGradAndJac.p>computeFinDiffGradAndJac at 28 In C:\Program Files\MATLAB\R2012a\toolbox\optim\optim\barrier.p>barrier at 135 In fmincon at 841 In main at 6 Error using mupadmex Error in MuPAD command: Subscripted assignment dimension mismatch

Error in sym/subsasgn (line 1638) C = mupadmex('symobj::subsasgn',A.s,B.s,inds{:});

Error in maxmin0 (line 142) y5(i)=solve(f5,x);

Error in maxmin (line 15) [PF0,eu0]=maxmin0(sub,DD);

Error in beta (line 18) mu = maxmin(sub,DD);

Error in C:\Program Files\MATLAB\R2012a\toolbox\shared\optimlib\finDiffEvalAndChkErr.p>finDiffEvalAndChkErr (line 26)

Error in C:\Program Files\MATLAB\R2012a\toolbox\shared\optimlib\finitedifferences.p>finitedifferences (line 128)

Error in C:\Program Files\MATLAB\R2012a\toolbox\optim\optim\private\computeFinDiffGradAndJac.p>computeFinDiffGradAndJac (line 28)

Error in C:\Program Files\MATLAB\R2012a\toolbox\optim\optim\barrier.p>barrier (line 135)

Error in fmincon (line 841) [X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] = barrier(funfcn,X,A,B,Aeq,Beq,l,u,confcn,options.HessFcn, ...

Error in main (line 6) [x,fval,exitflag,output,lambda,grad] = fmincon(@beta,[0.21,0.2,0.2,0.01,20,0.1,20,0.1],A,b,[],[],lb,ub,[],options)

and this the the related code for the error

if true
  %syms x 
if (isempty(y5(i))==1)

and you may notice that I add a if sentence to test isempty here. It is because some of you suggest that it may be the case there is not an explicit solution for f5. So I add an test isempty to solve this problem. But it is very depressing the program still shows the same error message.

I am really confused with my problem...I just don't understand where things is wrong...I really hope you can offer some advice.

  1 Comment

I used to think it is the case that only 2012 version gives my this error message. But this weekend I find in my laptop which is 2010 version it still gives me the similar error. The thing I have changed is the intial value in fmincon. I don't know if this is the problem...

Log in to comment.

0 Answers

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today