Adjusting my time axis(x axis) accordingly

10 ビュー (過去 30 日間)
Mohamed Jamal
Mohamed Jamal 2020 年 7 月 16 日
編集済み: Kelly Kearney 2020 年 7 月 16 日
Hi guys, I have signal that I sampled called y1, it's implicitly vector of values (samples), what I want to do is this think:
my frequency sampling : fs=10KHZ. so (1/10kHz is in seconds)
I want my time (x axis) to be like this:
I want the first value in the vector y1 (actually y1 is my signal) to be at t0=0 , second value to be at t1=t0+1/fs , third value to be at t2=t1+1/fs , fourth value of my vector to be at t3=t2+1/fs, n value of my vector to b at time tn=t(n-1)+1/fs or tn=t0 + n*(1/fs) .
the time is actually x axis, and the values (amplitude) of my signal y1 (the values of vector y1) is actually y axis.
could anyone please help me how to implement that thing ? implement that my x axis(time axis) be according to what I said above (x axis(time axis) related to 1/fs) ..
Ofcourse assuming that first value of my signal y1 (of my vector y1) is started at t=0.
thanks alot.
  1 件のコメント
Mohamed Jamal
Mohamed Jamal 2020 年 7 月 16 日
if you could help here at your free time, appreciated alot!

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

回答 (1 件)

Kelly Kearney
Kelly Kearney 2020 年 7 月 16 日
t = (0:(n-1))*(1/fs);
plot(t,y1)
  2 件のコメント
Mohamed Jamal
Mohamed Jamal 2020 年 7 月 16 日
n is the length of my signal vector? if so, then it should be (1:n)*1/fs no?
also (0:n-1)*(1/fs) it means the first I have 0, 1/fs , 2/fs , 3/fs .. yeah? but what I want is at time "n" it should be tn=t(n-1)+1/fs ..... thanks alot for your explanation.
Kelly Kearney
Kelly Kearney 2020 年 7 月 16 日
編集済み: Kelly Kearney 2020 年 7 月 16 日
I'm not quite sure whether your use of "n" refers to the length of the signal vector, or the to the 0-based max index (i.e. length(y1)-1), or any generic index. In my example, it was the former. Whether you index from 1 or 0, both options match your requirement that the time at a given index is 1/fs greater than the previous index. You said you wanted the first point to correspond to t = 0, so that's what my example does.

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

カテゴリ

Help Center および File ExchangeMatched Filter and Ambiguity Function についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by