Index: mttroot/mtt/lib/control/PPP/ppp_lin_quad.m ================================================================== --- mttroot/mtt/lib/control/PPP/ppp_lin_quad.m +++ mttroot/mtt/lib/control/PPP/ppp_lin_quad.m @@ -1,10 +1,9 @@ -function [k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw,J_xx,J_xw,J_ww,y_u,A_u] = \ +function [k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw,J_xx,J_xw,J_ww,A_u] = \ ppp_lin_quad (A,B,C,D,tau,Q,R) - ## usage: - ## [k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw,J_xx,J_xw,J_ww,y_u,cond_uu] = + ## usage:[k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw,J_xx,J_xw,J_ww,A_u] = ## ppp_lin_quad (A,B,C,D,tau,Q,R) ## ## ## Steady-state Linear Quadratic solution @@ -13,6 +12,7 @@ ## PPP solution [k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw,J_xx,J_xw,J_ww] = \ ppp_lin(A,B,C,D,A_u,A_w,tau,Q,R,P); +A_u endfunction Index: mttroot/mtt/lib/control/PPP/ppp_lin_run.m ================================================================== --- mttroot/mtt/lib/control/PPP/ppp_lin_run.m +++ mttroot/mtt/lib/control/PPP/ppp_lin_run.m @@ -117,12 +117,13 @@ if strcmp(p_c.Method, "original") tau = [10:0.1:11]*(2/a_u); # Time horizons [k_x,k_w,K_x,K_w] = ppp_lin(A,B,C,D,p_c.A_u,p_c.A_w,tau); # Design elseif strcmp(p_c.Method, "lq") # LQ design tau = [0:0.001:1.0]*5; # Time horizons - [k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw,J_xx,J_xw,J_ww,y_u,p_c.A_u] \ + [k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw,J_xx,J_xw,J_ww,A_u] \ = ppp_lin_quad (A,B,C,D,tau,p_c.Q,p_c.R); + p_c.A_u = A_u else error(sprintf("Control method %s not recognised", p_c.Method)); endif ##Sanity check A_u @@ -129,12 +130,12 @@ [p_c.n_U,M_u] = size(p_c.A_u); if (p_c.n_U!=M_u) error("A_u must be square"); endif - - U = K_w*w; # Initial control U + K_w,w + U = K_w*w # Initial control U ## Checks [ol_zeros, ol_poles] = sys2zp(sys) cl_poles = eig(A - B*k_x) endif