MATLAB: How to make the plot count by ones so that I have grid markers and numbers at each integer.

graphMATLABplot

My plot goes from time t=0 to t=15 on the x axis, but it's counting by 5's and I want it to count by ones so that all numbers are labeled and graph lines appear for every number on the time axis.

Best Answer

See if this does what you want:
x = linspace(0, 15,250);
y = sin(2*pi*x/10).*sin(5*pi*x/10);
figure(1)
plot(x, y)
grid
xt = get(gca, 'XTick') % Find Existing X-Ticks
xtix = min(xt) : max(xt); % Define New X-Ticks
set(gca, 'XTick',xtix) % Set New X-Tick Values