Filter löschen
Filter löschen

What does this code do

2 Ansichten (letzte 30 Tage)
Ralph
Ralph am 12 Dez. 2020
Beantwortet: KSSV am 12 Dez. 2020
I am picking up on someone else's code and I am having trouble understanding the meaning of the following lines:
[row,c]=size(x);
s=1;
for i=5:9:last_index %runs for total number of samples in signal
var1=(s-1)*9+1;
var2=s*9;
sd = std(x(var1:var2));

Akzeptierte Antwort

KSSV
KSSV am 12 Dez. 2020
[row,c]=size(x); % get dimensions of x
s=1; % s takes the value 1
for i=5:9:last_index % Array index values takes from 5 to last_index with difference of 9
var1=(s-1)*9+1; % creates a variables with this value
var2=s*9; % this value is 9
sd = std(x(var1:var2)); % calculates the standard deviation of values of x from var1 to 9.

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by