I need to plot two plots on same figure in MATLAB. The maximum and minimum values in both the data samples have large variation, which I am unable to plot by taking same y-axis limits. I do not wish to use two scales as explained in other Overlaying two axes in a Matlab plot but need to use a single y-axis and get the solution. I tried the code:
x_axis_X = 1:length(S);
y_axis_Y = 1:length(N);
ylim([-1204200 -1841.6])
set(gcf,'color','w');
plot(x_axis_X, S,'o-', y_axis_Y, N, 'x-');
The result is as shown in the plot where one data sample is plotted without proper y-axis range.
The y limits for first data sample is -1204200 to -1841.6 and for the second it is -489429345.5 to -10408189.43. How should be the ylim defined to fit both plots in the same figure? I appreciate your inputs. Thank you.