# Tangency portfolio with constraints

Hello to everyone I am trying to implement a version of MV optimization with constraints as UB and LB, it seems to work fine but now i was trying to figure out a simple way to derive a CML in the same fashion.

Here it is my code so far. I am looking for some hints on how to practically implement it.

%% GMV in a LO portfolio
AGMV = [UNO']
BGMV = [1]

MUGMV = MU*WGMVLO(:,1)
STDGMV = sqrt(2*VARGMV)
plot(STDLO,MULO,MINSTD,Er,STDGMV,MUGMV,'*')
%%NEW CODE Tangency portfolio
%%Starting with the new assumptions of LO portfolio, it seems reasonable in
%%order to find a new measure of benchmark, the most efficient considering
%%the Rf

ERCML = linspace(Rf,max(MULO)-0.05,N);
MUCML(:,1) = MU'-Rf.*UNO;
ACML = [MUCML']
WCML0=zeros(1,N)
for i=1:N
BCML = [ERCML(1,i)]