simple question of creating a time vector

21 ビュー (過去 30 日間)
rami zaboura
rami zaboura 2020 年 8 月 7 日
回答済み: Star Strider 2020 年 8 月 7 日
hello everyone,
i have a data set of 15345 samples, duration of 60 seconds, and sample frequency of 256 hz , how do i create the right time vector ?
i have tried to use : t=0:1/fs:1 and it wasnt correct, (fs being 256)
any suggetion would be helpful. thanks in advance:)

採用された回答

Star Strider
Star Strider 2020 年 8 月 7 日
Without the exact details of your file (that I suspect is not exactly 60 seconds long), something like this will work:
t = linspace(0, 60, 15345);
Note that this provides a sampling frequency of 255.73 Hz, so it may need to be tweaked a bit to get exactly the 256 Hz sampling frequency.
Calculating:
seconds = 15345/256
produces:
seconds =
59.9414
so you may want to check the actual duration.
.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEEG/MEG/ECoG についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by