/usr/share/octave/site/m/sundialsTB/cvodes/examples_ser/mcvsVanDPol_dns.m is in octave-sundials 2.5.0-3+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | function mcvsVanDPol_dns()
%mcvsVanDPol_dns - CVODES example problem (serial, dense)
% van der Pol problem.
% Radu Serban <radu@llnl.gov>
% Copyright (c) 2005, The Regents of the University of California.
% $Revision: 1.2 $Date: 2007/12/05 21:58:18 $
data.mu = 100.0;
t0 = 0.0;
tf = 300.0;
y0 = [2.0;0.0];
options = CVodeSetOptions('UserData',data,...
'RelTol',1.e-8,...
'AbsTol',1e-6,...
'JacobianFn',@djacfn);
mondata.mode = 'both';
mondata.skip = 20;
options = CVodeSetOptions(options,'MonitorFn',@CVodeMonitor,'MonitorData',mondata);
CVodeInit(@rhsfn, 'BDF', 'Newton', t0, y0, options);
ntout = 50;
dt = (tf-t0)/ntout;
tt = linspace(t0+dt,tf,ntout-1);
[status,t,y] = CVode(tt,'Normal');
CVodeFree;
figure;
plot(t,y(1,:),'r',t,y(1,:),'.');
% ===========================================================================
function [yd, flag, new_data] = rhsfn(t, y, data)
% Right-hand side function
mu = data.mu;
yd = [ y(2)
mu*(1-y(1)^2)*y(2)-y(1) ];
flag = 0;
new_data = [];
return
% ===========================================================================
function [J, flag, new_data] = djacfn(t, y, fy, data)
% Dense Jacobian function (if using Newton)
mu = data.mu;
J = [ 0 1
-2*mu*y(1)*y(2)-1 mu*(1-y(1)^2) ];
flag = 0;
new_data = [];
|