Need help for these two commands
Mostrar comentarios más antiguos
These are two lines
dif = length(sig) - length(ADSR);
x = cat(2, ADSR, zeros(1,dif));
What is purpose of zeros(1,dif) Plz explain
Respuesta aceptada
Más respuestas (2)
Fangjun Jiang
el 22 de Sept. de 2011
It creates a 1 by dif matrix and all its value is zero.
cat(2, ADSR, zeros(1,dif)) is the same as [ADSR, zeros(1,dif)]
I want to give a caution on using function length().
LENGTH(X) returns the length of vector X. It is equivalent
to MAX(SIZE(X)) for non-empty arrays and 0 for empty ones.
Walter Roberson
el 22 de Sept. de 2011
The code is constructing a vector that pads ADSR with 0s to be the same length as sig is.
Another way of doing this would be:
x = zeros(size(sig));
x(1:length(ADSR)) = ADSR;
Categorías
Más información sobre Beamforming and Direction of Arrival Estimation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!