I am try to simulate a controlled dynamical system of the form
$$\dot{x}=f(x,\phi(x)),$$
where $\phi$ is the controller. To do so, I am using Octave (an open source version of Matlab).
My commands lines are
out = lsode("cl_system",IC(1),time);
where lsode is the solver function, cl_system is the function f, IC the initial condition, and time is the vector for time simulation.
the cl_system was written as follows
function out = cl_system(x,t)
u = controller(x);
q_dot = fp(x,u);
out = q_dot;
endfunction.
Now, I would like to plot the vector u. In other words, I want to see the evolution of the controller in time. How can I do that?
Just extract your state $x$ at the end of the simulation (out variable in your code) and compute $\phi(x)$, which is your control input.