Hi, I have to draw a 'special grid' on a plot of a signal. Specifically, I need one vertical line after 8s and one 10s after the first (and then periodically in this order: 8s,10s,8s,10s etc etc..) How can I do this? I tried to use meshgrid but without results.
Thank you!

1 件のコメント

dpb
dpb 2016 年 10 月 30 日
Note the location in a time vector of some number of seconds will be
ix=round(T/dt);
where T is the set of desired times and dt the sample rate...

サインインしてコメントする。

回答 (1 件)

Riccardo Brambilla
Riccardo Brambilla 2016 年 10 月 30 日

0 投票

Thank you both for your time; I solve the problem in this way!
t = [0:1:size(sx)-1]'./fs;
a = ceil(t(end));
x = [8:18:a];
y = [18:18:a];
z = [x;y];
z = z(:).';
plot(t,sx,t,dx);
legend('pupil sx', 'pupil dx');
ax = gca;
ax.XGrid = 'on';
ax.YGrid = 'off';
ax.XTickMode = 'manual'; % keep the same number of 'grid lines' even after resize
ax.XTick = z;
ax.XMinorTick = 'on';

カテゴリ

タグ

質問済み:

2016 年 10 月 30 日

回答済み:

2016 年 10 月 30 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by