From: hank scorpio on
Hello,

I have imported a sound file which has given me a <127600x1 double> variable called 'data'
(mono, 24bit, around 3 secs at 48KHz)

Say I want to do a numerical integration between the first value and a value n - what is the syntax for this ? What about the integral for between say m and n ?

The position in the variable array is the x value if we were to graph the audio (we'd see an audio file)

Either it's too simple and I'm tangling myself up, or the examples don't cover this case ?

any help appreciated - cheers ;)
From: John D'Errico on
"hank scorpio" <breakbeak(a)hotmail.com> wrote in message <hrtvtq$2mr$1(a)fred.mathworks.com>...
> Hello,
>
> I have imported a sound file which has given me a <127600x1 double> variable called 'data'
> (mono, 24bit, around 3 secs at 48KHz)
>
> Say I want to do a numerical integration between the first value and a value n - what is the syntax for this ? What about the integral for between say m and n ?
>
> The position in the variable array is the x value if we were to graph the audio (we'd see an audio file)
>
> Either it's too simple and I'm tangling myself up, or the examples don't cover this case ?
>
> any help appreciated - cheers ;)

You cannot tell trapz only to integrate over some
subinterval.

However, you CAN extract that subinterval from
your data.

Then call trapz on the extracted vector.

John
From: hank scorpio on
ah

ok

oh dear - I'm going to be creating 127599 new vectors on the fly

m to n > trapz that > write value to preallocated loopnumber dimensioned vector
m to n+1 > trapz that > write value to preallocated loopnumber dimensioned vector
m to n+2 > trapz that > write value to preallocated loopnumber dimensioned vector
..
..
..

it might look like I want a cumulative integration (cumtrapz) but I'm going to be using each value in its place...

I cant really preallocate for all those sub vectors right ? maybe a cell array - or hmmm ?

thanks, by the way ;)
 | 
Pages: 1
Prev: multiple legend and marker in plot
Next: FFT