I cannot get Matlab to plot a a second time series to specific points along the x axis. My data are two time series. Time series A is a 5 X 1 and time series B is a 7 X 1. I need A to plot on xticklabels 1-5. Then, with 'hold on', I need time series B to be shifted to the right to plot on xticklabels 6:12. I keep getting the second plot to plot directly over the first plot without the shift occurring. I've tried among other things -->
set(gca,'XTick',[6 7 8 9 10 11 12]);
and it displays x axis numbers shifting but the data does not plot in positions 6:12. Any help is much appreciated. I've seen some online answers but can't seem to get it correct.
In Matlab, you can plot something using
plot(xArray, yArray);
. If you want to shift the plot along the x axis, you could useplot(xArray + amountToShift, yArray);
.As I believe shifting is not what your real problem is, I've added an example where data gets plotted in the way you described: