From: Ross Anderson on 26 Jul 2010 20:36 Hi all, I'm using ode15i to solve a system of DAEs. One of the terms is a time average of a function over the interval of integration dT. If I supply a tspan = [t0, t1, t2, ..., tf] to ode15i as well as my function, I can recover the dT being used: [T Y] = ode15i(@(t,y,yp) yprimefunc(t,y,yp,tspan),tspan,0,0); function Z = yprimefunc(t,y,yp,tspan) tstep = find(t==tspan); dT = tspan(tstep)-tspan(tstep-1); Z = y-yp; end But picking a standard tspan=linspace(t0,tf,N) to supply to ode15i makes the convergence very slow. Allowing it to choose its own tspan=[t0, tf] speeds this up, but I still need to know the dT the solver is using. How can I recover that in my DAE function?
From: Torsten Hennig on 26 Jul 2010 23:08 > Hi all, > > I'm using ode15i to solve a system of DAEs. One of > the terms is a time average of a function over the > interval of integration dT. If I supply a tspan = > [t0, t1, t2, ..., tf] to ode15i as well as my > function, I can recover the dT being used: > > [T Y] = ode15i(@(t,y,yp) > yprimefunc(t,y,yp,tspan),tspan,0,0); > function Z = yprimefunc(t,y,yp,tspan) > tstep = find(t==tspan); > dT = tspan(tstep)-tspan(tstep-1); > Z = y-yp; > end > > But picking a standard tspan=linspace(t0,tf,N) to > supply to ode15i makes the convergence very slow. > Allowing it to choose its own tspan=[t0, tf] speeds > this up, but I still need to know the dT the solver > is using. How can I recover that in my DAE function? lim (deltat->0) int_{t0}^{t0+deltat} y(t) dt / deltat = y(t0) So for deltat small, the average of a function f over the interval [t0;t0+deltat] is just f(t0). Or : If you need the average u of a function f over the interval [tstart,t], you can solve the differential equation du/dt = (f(t)-u(t))/(t-tstart) with u(tstart) = f(tstart) in u. Best wishes Torsten.
|
Pages: 1 Prev: Calculation of dpss function with variable precision Next: Using Simulink powergui in Labview |