# # vanderpol_demo.m # # Octave demonstration script that uses the vector field # defined in vanderpol.m # # This file was generated by the program VFGEN (Version:2.4.0) # Generated on 10-Jul-2008 at 15:49 # # Global vector for the parameters. global vanderpol_parameters; # Load the vector field definition and the jacobian. source "vanderpol.m"; # --- Parameters --- vanderpol_parameters(1) = 0.2; # epsilon # --- Initial conditions --- x_(1) = 0.01; x_(2) = 0; # --- Time values --- t0_ = 0.0; t1_ = 10.0; numpoints = 201; t_ = linspace(t0_,t1_,numpoints); # --- Solver error tolerances --- lsode_options("relative tolerance",1e-6); lsode_options("absolute tolerance",1e-8); # --- Call the ODE solver --- xsol_ = lsode({"vanderpol_vf","vanderpol_jac"},x_,t_); # --- Plot the solution --- hold off plot(t_,xsol_(1:end,1),";x;") hold on plot(t_,xsol_(1:end,2),";y;") grid on xlabel("t")