Creating time vector using number of samples
古いコメントを表示
I have the following parameters:Total number of samples: 5000, samplerate: 2500.I created my time vector as usual: t=0:1/2500:5000-1/2500. But the time vector is a lot bigger than my related data vector which makes plotting impossible. Am I misunderstanding the meaning of sample number?
採用された回答
その他の回答 (1 件)
Aniruddh Maini
2022 年 7 月 2 日
0 投票
Hi Lina
As per your question NumSamples = 5000 and SampleRate = 2500
That means, in one seconds the signal will be sampled 2500 times or we will get 2500 samples each second, and we have to get 5000 samples in total.
So let's say
At t = 0 sec we get a sample
At t = 0 + (1/2500) we get another sample
At t = 0+(1/2500)+(1/2500) we get another sample.
and so on...
So from the observation we can say that total time required to get 5000 samples is (1/2500)*(5000-1)
Since we are getting 5000 samples between t = 0 and t = (1/2500)*(5000-1), so the SampleTime vector can be found as
timeVector = 0:1/2500:(1/2500)*(5000-1) or alternatively as
timeVector = linspace(0,(1/2500)*(5000-1),5000)
Hope it helps.
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!