fmincon - Index Exceeds Matrix Dimensions
Afficher commentaires plus anciens
Dear friends,
I am trying to plot a 3D truss structure together with "fmincon" function. I have got an error and couldn't find the problem.
However, the following errors are obtained :
Index exceeds matrix dimensions.
Error in Topo_3D/truss (line 164)
elnodes = elem(iel, 1:3);
Error in Topo_3D/outfun (line 144)
truss(x);
Error in callAllOptimOutputFcns (line 13)
stop(i) = feval(OutputFcn{i},xOutputfcn,optimValues,state,varargin{:});
Error in barrier
Error in fmincon (line 798)
[X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] =
barrier(funfcn,X,A,B,Aeq,Beq,l,u,confcn,options.HessFcn, ...
Error in Topo_3D (line 30)
[x,fval,ef,output,lambda,hessian] = fmincon(objective,x0,A,b,Aeq,beq,lb,ub,nonlincon,options);
A copy of my fmincon function is attached.
I appreciate if somebody can help with this errors and how can it be solved.
Thank you very much!
RTFQ
6 commentaires
Ameer Hamza
le 29 Mar 2020
I cannot run your code because it require the file 'truss1.tcl'. But from the error message It appear that in the line
elnodes = elem(iel, 1:3);
you are trying to access elements in the matrix elem which does not exist. You can add breakpoint on this line to check the dimensions of elem matrix.
Richard
le 29 Mar 2020
Walter Roberson
le 29 Mar 2020
We do not have information about the format of the truss file.
What we can say is that if the z data exists in the truss file at all (not certain) then your code never reads it in.
Richard
le 30 Mar 2020
Ameer Hamza
le 30 Mar 2020
Richard, your code reads several other files too. Also, I suggest reading these files once, at the beginning of your code, and then pass the variables to your function. Reading files repeatedly will significantly slow down your code.
Richard
le 30 Mar 2020
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Solver Outputs and Iterative Display dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!