Filter löschen
Filter löschen

convert matrix steps from 1 to 0.1

1 Ansicht (letzte 30 Tage)
Aaron Rosenberger
Aaron Rosenberger am 14 Jan. 2023
Kommentiert: Star Strider am 15 Jan. 2023
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 :)

Antworten (2)

VBBV
VBBV am 14 Jan. 2023
Bearbeitet: VBBV am 14 Jan. 2023
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 Kommentare
VBBV
VBBV am 14 Jan. 2023
Count of matrix elements are always in positive integers. Not in decimals or fractions. If you mean to divide a vector of values in 0.1 step increments then you can do
data./10
Aaron Rosenberger
Aaron Rosenberger am 15 Jan. 2023
Thank you !:)

Melden Sie sich an, um zu kommentieren.


Star Strider
Star Strider am 14 Jan. 2023
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 Kommentare
Aaron Rosenberger
Aaron Rosenberger am 15 Jan. 2023
Thank you very much !:)
Star Strider
Star Strider am 15 Jan. 2023
My pleasure!

Melden Sie sich an, um zu kommentieren.

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by