I am plotting an EEG time series in MATLAB. The vector is 4097*1. The duration of recorded signal is 23 seconds. The MATLAB plot function is plotting the signal with amplitude on y-axis and number of sample on x-axis. However, I need the time on x-axis with scale multiple of 5 seconds. The figure is shown with time on x-axis (Referred from a paper). I tried following code using 'xticks', but the x-axis remained same.
hFig = figure;
hAx = gca;
ts = 0:length(d); % the data time series
stairs(ts(2:end), d, 'LineWidth', 2);
xticks ([0 5 10 15 20 25 30])
hAx.XLabel.String = 'Time (Seconds)';
I appreciate your support. Thank you.
xticks
function, what do you get? – Sardar Usamaset(gca,'XTick',0:5:30)
? – Sardar Usama