help-octave
[Top][All Lists]
Advanced

[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:53:23 -0700 (MST)

I have written a code for solving udot=0 , u_0=23 using daspk solver.
Obviously the output should be 23 for all times. But it is instead giving
NaNs after time t=0. At t=0, u=23 and udot=0 as supplied in the intial
condition.

*The code is as follows :*
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)

*
The function for residual calculation is :*

function res=test(u,udot,t)
        res(1)=udot;
endfunction


The output i get is :
u=
23
NaN
NaN
NaN
.
.
.

udot= 
0
NaN
NaN
NaN
.
.
.

I am new to using daspk solver and can't figure out the problem. Also, the
code works fine if i replace daspk with dassl and computes the correct
solution.



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]