convert matrix steps from 1 to 0.1

3 ビュー (過去 30 日間)
Aaron Rosenberger
Aaron Rosenberger 2023 年 1 月 14 日
コメント済み: Star Strider 2023 年 1 月 15 日
Hello,
i got a task with 2 Signals. I need to plot them on the x axis with from 0 seconds to 0.1 seconds. (200000 data with a frequency of 10Khz)
i have no clue how to do that. I limited the x axis t o1000 data (value of 0 to 0.1 seconds) but the numbers are still incorect.
thanks :)

回答 (2 件)

VBBV
VBBV 2023 年 1 月 14 日
編集済み: VBBV 2023 年 1 月 14 日
If you are plotting 0 to 0.1 sec using 1000 data points, the you have to divide it by frequency, 10 kHz
data./10000
Instead of
data*10000
Which you are doing presently
  2 件のコメント
Aaron Rosenberger
Aaron Rosenberger 2023 年 1 月 15 日
Thank you !:)

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


Star Strider
Star Strider 2023 年 1 月 14 日
Use the linspace function to define the time vector —
L = 0.1; % signal Length (sec)
Fs = 1E+4; % Sampling Frequency
t = linspace(0, L*(Fs-1), Fs)/Fs; % Time Vector
format long
Ts = t(2)-t(1) % Sampling Interval
Ts =
1.000000000000000e-05
f = 10; % Signal Frequency
s = sin(2*pi*t*f); % Create Signal
figure
plot(t,s)
grid
xlabel('Time (s)')
ylabel('Amplitude')
.
  2 件のコメント
Star Strider
Star Strider 2023 年 1 月 15 日
My pleasure!

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

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by