Meaning of a sentence in a code

1 次查看(过去 30 天)
M=3;n=0:30*M-1;
m=0:29;
x=sin(2*pi*0.04*n);
% y=x([1:M:length(x)]);

采纳的回答

KSSV
KSSV 2021-12-16
编辑:KSSV 2021-12-16
You can know it by your self. Just take a print of the values.
M=3;
n=0:30*M-1;
m=0:29;
x=sin(2*pi*0.04*n);
idx = 1:M:length(x) % generate indices picking every third element of array
idx = 1×30
1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49 52 55 58 61 64 67 70 73 76 79 82 85 88
y=x(idx) % extract the elements
y = 1×30
0 0.6845 0.9980 0.7705 0.1253 -0.5878 -0.9823 -0.8443 -0.2487 0.4818 0.9511 0.9048 0.3681 -0.3681 -0.9048 -0.9511 -0.4818 0.2487 0.8443 0.9823 0.5878 -0.1253 -0.7705 -0.9980 -0.6845 -0.0000 0.6845 0.9980 0.7705 0.1253

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multirate Signal Processing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by