Re: average variable using ODE




In article <40d5fafe-6ec7-4784-aa3a-b164e35fccaf@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
BSG <biswasengupta@xxxxxxxxx> writes:
On 7 Feb, 08:14, Torsten Hennig <Torsten.Hen...@xxxxxxxxxxxxxx> wrote:
Hi Torsten,

Thanks for the message. I have copy pasted a run of an >example ODE
with the 1st column being time, the next being the >function value and
the third is the running average of the function(2nd >column)
t y(t) z
1 1 0
1.0001 1 0.0001
1.0001 1.0001 0.0001

Matlab code for producing these numbers
[t,y] = ode45(@testfu,[1 5],[1;0]);
function dydt = testfu(t,y)
dydt = [cos(y(1));y(1)];

Now, if you see the third column which is supposed to be >a running sum
of the 2nd column, then you can see the discrepancy. If >the third
column were a running average of the 2nd column then it >would exactly
be a cumulative sum of the 2nd column, which it is >certainly not. Your
advice would be highly appreciated.

Cheers,BSG

Hi,

maybe you mix something up.

The third column represents
integral_{t'=0}^{t'=t} y1(t') dt'
where t is the value of the first column.
This is the area under the curve for y1(t) at time t.

To get an average value for y1 in the interval
[0;t], you have to divide the third column by the first
column.

Or what exactly do you mean by 'running sum' and
'running average' ?

Best wishes
Torsten.- Hide quoted text -

- Show quoted text -

Thanks guys, running_average = running_sum/time_duration
The confusion that I have is doesn't the third column be equal to the
cumulative sum (running sum) of the 2nd column. Then to get the
average over [0 T], I would simply take the last element(5.7126 -
running sum until T) of third column and divide by T (in this eg. it
is 5)? Am I missing something?

no, you got it
hth
peter

.



Relevant Pages

  • Re: average variable using ODE
    ... if you see the third column which is supposed to be>a running sum ... column were a running average of the 2nd column then it>would exactly ... where t is the value of the first column. ...
    (sci.math.num-analysis)
  • Re: average variable using ODE
    ... column were a running average of the 2nd column then it>would exactly ... where t is the value of the first column. ... cumulative sum (running sum) of the 2nd column. ... running sum until T) of third column and divide by T (in this eg. it ...
    (sci.math.num-analysis)
  • compare cells in column to criteria, then average next column cell
    ... I have a spreadsheet that has two columns. ... first column for a specific value, and if the value is met, average the value ... in the cell adjacent in the next column to previous values returned. ... column E to a running average. ...
    (microsoft.public.excel.worksheet.functions)