Gentlemen:
The code below is a portion of an Octave m-file for the solution of a 2nd order ODE. The solution is generated just fine, but the graphical output is not working entirely correctly. In figure(1), the time axis is correctly drawn, but if I activate the similar commands to draw the time axis in either of the subplots under figure(2), the main curve is removed. Also, the grid is not present in the upper subplot, despite the fact that grid on is active. Is this a bug, or an error on my part? Can you give me a fix, please? Thanks,
Sam
figure(1); clf; hold on; grid on % two normalized curves
plot(t,x1/x1mx,'k-',"LineWidth",2,t,x2/x2mx,'r-')
plot([0 tmx],[0 0],'k',"LineWidth",1) % draw t-axis
xlabel("time, t sec")
title("Normalized Response Curves","fontsize",20)
figure(2); % using two subplots
hold on; grid on
subplot(2, 1, 1); % two rows, one column, first row
plot(t, x1,'k',"LineWidth",2);
%plot([0 tmx],[0 0],'k',"LineWidth",1) % draw t-axis WIPES OUT THE MAIN CURVE
xlabel("t (sec)");
ylabel("x(t)")
title("Solution Curve, x(t)","fontsize",20);
subplot(2, 1, 2); % two rows, one column, second row
grid on % THIS DOES NOT SEEM TO WORK!!!!
plot(t, x2,'k',"LineWidth",2);
%plot([0 tmx],[0 0],'k',"LineWidth",1) % draw t-axis WIPES OUT THE MAIN CURVE
xlabel("t (sec)");
ylabel("xdot(t)");
title("First Derivative, xdot(t)","fontsize",20);