How to Integrate a vector?

29 ビュー (過去 30 日間)
Fourier
Fourier 2017 年 8 月 30 日
コメント済み: Star Strider 2019 年 10 月 21 日
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

採用された回答

Star Strider
Star Strider 2017 年 8 月 30 日
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 件のコメント
Peter Druzba
Peter Druzba 2019 年 10 月 20 日
Thanks, very helpfully !
Star Strider
Star Strider 2019 年 10 月 21 日
@Peter Druzba — My pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumerical Integration and Differentiation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by