[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
daspk solver giving NaN
From: |
Master |
Subject: |
daspk solver giving NaN |
Date: |
Mon, 14 May 2018 07:36:04 -0700 (MST) |
I have written a code to solve a simple ODE uprime=0 and u_0=23. The solution
should obviously be u=23 at each timestep.
The code is as given:
u_0=23;
udot_0=0;
u=zeros(50,1);
udot=zeros(50,1);
for i=1:50
t(i)=(i-1)*2;
end
t_crit=100;
daspk_options("compute consistent initial condition",0);
daspk_options("algebraic variables",0);
[u, udot, istate, msg] = daspk(@test, u_0, udot_0, t, t_crit)
*
And the function to evaluate residuals is as : *
function res=test(u,udot,t)
res(1)=udot;
endfunction
But the output of the code is :
u=
23
NaN
NaN
.
.
.
. and
udot=
0
NaN
NaN
NaN
.
.
.
I am new to using daspk, and unable point out the error. However, if i
replace daspk with dassl, it computes the correct solution.
--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
- daspk solver giving NaN,
Master <=