Re: average variable using ODE
- From: spellucci@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (Peter Spellucci)
- Date: Thu, 7 Feb 2008 14:00:33 +0100 (CET)
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
.
- References:
- Re: average variable using ODE
- From: BSG
- Re: average variable using ODE
- From: Torsten Hennig
- Re: average variable using ODE
- From: BSG
- Re: average variable using ODE
- Prev by Date: solutions to circuit analysis problems by william h hayt
- Next by Date: Re: Non-linear least squares using piece-wise approximation....
- Previous by thread: Re: average variable using ODE
- Next by thread: Poker Site Reviews to all the Major Poker Sites & 22 Exclusive Poker Bonuses + Freerolls
- Index(es):
Relevant Pages
|