Expanation for function length (x)-1
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
what is the basic purpose of the function t=0:1/fs [length (x)-1]
0 Commenti
Risposte (1)
DGM
il 30 Dic 2022
Modificato: DGM
il 30 Dic 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 Commenti
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!