# How to express dynamics when my problem comes from a PDE?

Sorry but I dont know how to insert my code. Many sign disappears. I will renew it if someone can tell this.
I am following a paper and want to repeat its result, but I get an infeasible status at the beginning. I want to know if I make some mistake in my code. Using one equality sign or two may be trouble I guess.
The first problem is this:

My code is this:

``````cvx_begin
variables T(3,N)  Gamma(N) kappa_aR(N)
expressions m(N) r(3,N) v(3,N) a(3,N) a_R(3,N)
minimize(-w_mf*m(N)+w_kappaaR*norm(kappa_aR,2));
%boundary conditions
subject to
m(1) == m_0;r(:,1) == r_0;v(:,1) = v_0;
T(:,1) == Gamma_0vac.*n_0hat;Gamma(1) == Gamma_0vac;
r(:,N) == [0,0,0]';v(:,N) == [0,0,0]';
T(:,N) == Gamma(N).*n_fhat;
%Dynamics
for i = 1:k_f
m(i+1) = m(i)-(alpha/2*(Gamma(i)+Gamma(i+1))+dm_bp)*dtau;
r(:,i+1) = r(:,i) + dtau.*v(:,i) +(dtau^2/3).*(a(:,i)+a(:,i+1)./2);
v(:,i+1) = v(:,i) + (dtau/2).*(a(:,i)+a(:,i+1));
end
for i = 1:N
a(:,i) = (T(:,i)-(rho*S_D*C_D*s(i)/2).*v(:,i))./mu(i)+a_R(:,i)+g;
end
%state constriants
for i = 1:N
m_dry<=m(i);
norm(r(:,i),2)*cos(gamma_gs)<=e_uhat'*r(:,i);
end
%control constriants
for i = 1:N
norm(T(:,i),2)<=Gamma(i);
T_min<=Gamma(i)<=T_max;
Gamma(i)*cos(theta_max)<=e_uhat'*T(:,i);
end
for i = 1:k_f
dT_min*dtau<=Gamma(i+1)-Gamma(i)<=dT_max*dtau;
end
%SC Modifications
for i = 1:N
norm(a_R(i),2)<=kappa_aR(i);
end
cvx_end``````

There is more than one way to do this in CVX. I suggest not using expressions with assignments, which use `=` . So,don’t have any declared expressions. Only use equality constraints, which are `==` . It should be straightforward to implement in CVX.

If you need more help,. please provide all input data, so that the problem is repoducible by forum readers.