RagsRams
Mechanical
- Aug 18, 2008
- 1
I am trying to use the ODE15s to solve a set of stiff differential equations. the problem is:
Given y"=A, where A is an output from another function and is a finite number.
the solver is within a for loop for evaluating the values at time t+dt in every iteration.
I am solving for y using the syntax:
dt=1e-3;
for t=0:dt:5
dy=ode15s(ode15s('soluda',[t t+dt],[0],[],A);
y=ode15s(ode15s('solua',[t t+dt],[0],[],dy);
end
the functions are:
---------
function dy=soluda(g,y,flag,A)
dy=A;
---------
---------
function y=solua(g,y,flag,dy)
y=dy
---------
Is my syntax correct?
I get a solution but I have my doubts regarding the initial values at time '0' = 0 and the timespan I have in the code [t+dt]
Please help.
Thx
Given y"=A, where A is an output from another function and is a finite number.
the solver is within a for loop for evaluating the values at time t+dt in every iteration.
I am solving for y using the syntax:
dt=1e-3;
for t=0:dt:5
dy=ode15s(ode15s('soluda',[t t+dt],[0],[],A);
y=ode15s(ode15s('solua',[t t+dt],[0],[],dy);
end
the functions are:
---------
function dy=soluda(g,y,flag,A)
dy=A;
---------
---------
function y=solua(g,y,flag,dy)
y=dy
---------
Is my syntax correct?
I get a solution but I have my doubts regarding the initial values at time '0' = 0 and the timespan I have in the code [t+dt]
Please help.
Thx