I am trying to plot a three dimensional phase portrait of a system of first order differential equations, but I am getting an error message saying I have an unrecognized variable eta. Apart from the three dimensional phase portrait, I also want to plot x(1) versus t, x(2) versus t, and x(3) versus t, all on the same graph. I have commented out this plot command because I'm sure I'm wrong. So, I am looking to plot (i) a 3D phase portrait, and (ii) a time plot of x(1), x(2) and x(3) all on the same graph. Also, the [-0.015,0.015], [-2,2], [-4,4] that you see in the argument of the ode45 are the axes limits of x(1), x(2) and x(3). I am not even sure that the axes limits should be placed there. Could someone please help? Thank you.
[t,x] = ode45(@eqx3, eta, omega, [-0.015,0.015], [-2,2], [-4,4], initcond);
global eta omega
eta = 0.05;
omega = 25;
%tspan = [0,50]
initcond = [1, 0.5, -0.4]
%subplot(211)
%plot(t, x(:,1), t,x(:,2),'--',x(:,3),'--');
%xlabel('t')
subplot(212)
plot(x(:,1), x(:,2), x(:,3))
xlabel('x1')
ylabel('x2')
zlabel('x3')
function xdot = eqx3(t,x,eta,omega)
global eta omega
xdot = zeros(3,1);
xdot(1) = -(2*eta*omega + 1)*x(1) + x(2) - 1;
xdot(2) = -(2*eta*omega + (omega^2))*x(1) + x(3) + 2;
xdot(3) = -(omega^2)*x(1) + x(2) - 1;
%xdot =[xdot(1);xdot(2);xdot(3)];
end

initcondafter callingode45. Move it to the first line in your program. Same thing withetaandomega.globalshould not be necessary and it is usually frowned upon. You are already passingetaandomegaas function arguments toeqx3, so no need to declare them asglobalvariables.