How to Integrate a vector?

32 vues (au cours des 30 derniers jours)
Fourier
Fourier le 30 Août 2017
Commenté : Star Strider le 21 Oct 2019
I have an audio file that gives me a long vector when I read it.I am asked to integrate the response over a specific time. My approach is to calculate time 'x' at which the vector reaches its 'ith'element. and then I will integrate it over the time. Can anyone guide

Réponse acceptée

Star Strider
Star Strider le 30 Août 2017
To integrate a vector, use the trapz (link) or cumtrapz (link) function, depending on the result you want.
You probably need to calculate a time vector as well. Since audio files are column-major matrices (each column is a different channel), this will work to calcualte the time vector, with ‘y’ being your sound file, and ‘Fs’ your sampling frequency:
tv = linspace(0, size(y,1), size(y,1))'/Fs;
  6 commentaires
Peter Druzba
Peter Druzba le 20 Oct 2019
Thanks, very helpfully !
Star Strider
Star Strider le 21 Oct 2019
@Peter Druzba — My pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Numerical Integration and Differentiation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by