function [eta_trj,Q] = optimize_Trajectory_M_1(A,Qr,P,N,K,sigma2,rho,H,w,Smax)
%UNTITLED10 Summary of this function goes here
%   Detailed explanation goes here



cvx_begin quiet

        variable Q(N,2)
        variable eta_trj 
        maximize eta_trj 

        subject to 
             
                    rate_convex_trajectory_M1(Q,A,Qr,P,N,K,sigma2,rho,H,w) >= eta_trj ; 
                    Q(1,:) == Q(N,:) ;                     
                    for n = 1:N-1 
                        norm(Q(n+1,:)-Q(n,:),2) <= (Smax) ; 
                    end
                    
cvx_end

end

