Replace zeros with a number

I am trying to create an upper bound condition for a portfolio weighting problem to equal 2%. How can I replace the zeros in the following matrix to equal 0.02?
UB = zeros(N,1)
Thanks

Respuestas (1)

madhan ravi
madhan ravi el 28 de Mzo. de 2019

0 votos

UB(UB==0) = 0.02;
% why not
UB = 0.02*ones(N,1) % in the first place?

Categorías

Más información sobre Portfolio Optimization and Asset Allocation en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 28 de Mzo. de 2019

Respondida:

el 28 de Mzo. de 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by