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!