Raster plot の作製

4 ビュー (過去 30 日間)
Saito
Saito 2019 年 12 月 9 日
コメント済み: Saito 2019 年 12 月 19 日
スパイクの頻度をTime stampで表したもの(添付ファイル:timestamp.mat)をプロットする為に、以下のスクリプトを用いました。
load('timestamp.mat');
t=SPKCa;
n = numel(t);
x =t;
ystart=repmat(0,1,n);
yend=repmat(1,1,n);
figure; hold on;
for idx =1: numel(ystart)
plot([x(idx) x(idx)], [ystart(idx) yend(idx)],'k');
end
これに時間指定、例えば1秒から2秒までのスパイクを選択するにはどうしたら良いでしょう?

採用された回答

Musashi Ito
Musashi Ito 2019 年 12 月 15 日
グラフの表示で良ければ、プロットした後に 時間軸の x 軸の座標軸を調整してみてはいかがでしょうか。xlim 関数で調整ができます。
% データの読み込み
load('timestamp.mat');
% 変数の整理
t = SPKCa;
n = numel(t);
x = t;
ystart = zeros(n,1);
yend = ones(n,1);
% グラフの作成
figure
plot([x(1) x(1)], [ystart(1) yend(1)],'k-');
hold on
for idx=2:n
plot([x(idx) x(idx)], [ystart(idx) yend(idx)],'k-');
end
hold off
xlim([1 2]) % x 軸を 1 ~ 2 に調整
ylim([-0.1 1.1]) % y 軸を -0.1 ~ 1.1 に調整
  1 件のコメント
Saito
Saito 2019 年 12 月 19 日
有難うございます!

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

その他の回答 (0 件)

カテゴリ

Help Center および File Exchangeグラフィックス オブジェクトの識別 についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!