Expanation for function length (x)-1
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
what is the basic purpose of the function t=0:1/fs [length (x)-1]
0 Kommentare
Antworten (1)
DGM
am 30 Dez. 2022
Bearbeitet: DGM
am 30 Dez. 2022
That's not a function, and it's not valid MATLAB syntax either. It's hard to say what it means, because I have to assume that it's assembled from unrelated pieces.
This
t=0:1/fs
creates a simple vector from 0 to 1/fs with a step size of 1. See colon, :
This
length(x)-1
returns the scalar length of the array x, minus 1. The "length" of an array is not dependent on its orientation; rather, it's the size of the longest dimension.
This
t=0:1/fs [length (x)-1]
will simply return an error. Implicit multiplication isn't allowed in MATLAB, so the juxtaposed expressions will result in an error. While not an error, wrapping the second expression in square brackets accomplishes nothing. Square brackets are used for concatenation, so you're trying to concatenate a scalar.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!