How plot or view each element of optimexpr variable in case of problem-based optimization?
Afficher commentaires plus anciens
I have written a code with some variables and one of them is w(optimexpr) which is a combination from two optimvar variables.
v = optimvar('v',length(T),length(geradores),...
'Type','integer','LowerBound',0,'UpperBound',1);
u = optimvar('u',length(T),length(geradores),...
'Type','integer','LowerBound',0,'UpperBound',1);
w = optimexpr(length(T),length(geradores));
for j = 1:length(T)
for k = 1:length(geradores)
if j==length(T)
w(j,k) = u(j,k)-u(1,k)+v(j,k);
else
w(j,k) = u(j,k)-u(j+1,k)+v(j,k);
end
end
end
To show or plot elements of optimvar just write this:
fprintf('\nMatriz v\n\n')
disp(sol.v)
fprintf('\nMatriz u\n\n')
disp(sol.u)
I have tried the same command for use w for plot/display but matlab show me error:
Unrecognized field name "w".
Error in otimizacao_gerenciamento2 (line XXXX)
disp(sol.w)
Someone help me with this, please? Thanks in advance.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Get Started with Problem-Based Optimization and Equations 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!