This should be a very simple question for anyone who has some experience in this area, but I'm still new to this.
I have the following system (or here is an image with better resolution):
Given the following input:
u = min(2 - t/7.5, 2*(mod(t, 2) < 1));
I need to plot the output of system y.
I am describing the system with the following function:
function xprime = func(t, x)
u = min(2 - t/7.5, 2*(mod(t, 2) < 1));
xprime = [
x(2);
x(3);
0.45*u - 4*x(3)^2 - x(2)*x(1) - 4*x(2) - 2*x(1);
x(5);
sin(t) - 3*x(5)*x(1);
];
and simulating with ode23
, like this:
[tout, xout] = ode23(@func, [0 15], [1.5; 3; -0.5; 0; -1])
After the simulation, xout
will have five columns. My question is: how do I know which one is the output of the y system?
EDIT: Ok, so to put it simple, I'd like to plot the solution like this:
a = 1 % what goes here? 1, 2, 3, 4 or 5?
plot(tout, xout(:,a))