Azzera filtri
Azzera filtri

Meaning of a sentence in a code

1 visualizzazione (ultimi 30 giorni)
Raj Arora
Raj Arora il 16 Dic 2021
Modificato: KSSV il 16 Dic 2021
M=3;n=0:30*M-1;
m=0:29;
x=sin(2*pi*0.04*n);
% y=x([1:M:length(x)]);

Risposta accettata

KSSV
KSSV il 16 Dic 2021
Modificato: KSSV il 16 Dic 2021
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

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by