From: <tr...@us...> - 2008-03-14 22:24:35
|
Revision: 4749 http://octave.svn.sourceforge.net/octave/?rev=4749&view=rev Author: treichl Date: 2008-03-14 15:24:37 -0700 (Fri, 14 Mar 2008) Log Message: ----------- Cleanup and minor changes. Modified Paths: -------------- trunk/octave-forge/main/odepkg/inst/odepkg.m trunk/octave-forge/main/odepkg/inst/odepkg_examples_dae.m trunk/octave-forge/main/odepkg/inst/odepkg_examples_ide.m Modified: trunk/octave-forge/main/odepkg/inst/odepkg.m =================================================================== --- trunk/octave-forge/main/odepkg/inst/odepkg.m 2008-03-14 13:16:53 UTC (rev 4748) +++ trunk/octave-forge/main/odepkg/inst/odepkg.m 2008-03-14 22:24:37 UTC (rev 4749) @@ -61,11 +61,14 @@ %# From command line in the 'src' directory do something like this: %# octave --quiet --eval "odepkg ('odepkg_validate_ccfiles')" - vfile = {'odepkg_octsolver_mebdfdae.cc', 'odepkg_octsolver_mebdfi.cc', ... %#'odepkg_octsolver_ddaskr.cc', ... + vfile = {'odepkg_octsolver_mebdfdae.cc', 'odepkg_octsolver_mebdfi.cc', ... + 'odepkg_octsolver_ddaskr.cc', ... 'odepkg_octsolver_radau.cc', 'odepkg_octsolver_radau5.cc', ... 'odepkg_octsolver_rodas.cc', 'odepkg_octsolver_seulex.cc'}; - vsolv = {'odebda', 'odebdi', ...#'odekdi', ... + vsolv = {'odebda', 'odebdi', 'odekdi', ... 'ode2r', 'ode5r', 'oders', 'odesx'}; + %# vfile = {'odepkg_octsolver_ddaskr.cc'}; + %# vsolv = {'odekdi'}; for vcnt=1:length(vfile) printf ('Testing function %s ... ', vsolv{vcnt}); @@ -75,6 +78,9 @@ function [] = odepkg_internal_mhelpextract () + %# In the inst directory do + %# octave --quiet --eval "odepkg ('odepkg_internal_mhelpextract')" + vfun = {'odepkg', 'odeget', 'odeset', ... 'ode23', 'ode45', 'ode54', 'ode78', ... 'ode23d', 'ode45d', 'ode54d', 'ode78d', ... @@ -118,6 +124,9 @@ function [] = odepkg_internal_octhelpextract () + %# In the src directory do + %# octave --quiet --eval "odepkg ('odepkg_internal_octhelpextract')" + vfiles = {'../src/odepkg_octsolver_mebdfdae.cc', ... '../src/odepkg_octsolver_mebdfi.cc', ... '../src/odepkg_octsolver_ddaskr.cc', ... @@ -204,29 +213,17 @@ end fprintf (1, ['-----------------------------------------------------------------------------------------\n']); -function [] = demos () +function [] = odepkg_internal_demos () -% test ('ode78', 'verbose'); clear ('all'); -% test ('ode54', 'verbose'); clear ('all'); -% test ('ode45', 'verbose'); clear ('all'); -% test ('ode23', 'verbose'); clear ('all'); + vfun = {'odepkg', 'odeget', 'odeset', ... + 'ode23', 'ode45', 'ode54', 'ode78', ... + 'ode23d', 'ode45d', 'ode54d', 'ode78d', ... + 'odeplot', 'odephas2', 'odephas3', 'odeprint', ... + 'odepkg_structure_check', 'odepkg_event_handle'}; + vfun = sort (vfun); - demo ('odeget.m'); clear ('all'); - demo ('odeset.m'); clear ('all'); - demo ('odepkg_structure_check.m'); clear ('all'); - demo ('odepkg_event_handle.m', 'verbose'); clear ('all'); + for vcnt = 1:length (vfun), demo (vfun{vcnt}); end - demo('odeplot.m', 'verbose'); clear ('all'); - demo('odephas2.m', 'verbose'); clear ('all'); - demo('odephas3.m', 'verbose'); clear ('all'); - demo('odeprint.m'); clear ('all'); - - demo ('odepkg_equations_lorenz'); clear ('all'); - demo ('odepkg_equations_pendulous'); clear ('all'); - demo ('odepkg_equations_roessler'); clear ('all'); - demo ('odepkg_equations_secondorderlag'); clear ('all'); - demo ('odepkg_equations_vanderpol'); clear ('all'); - %# Local Variables: *** %# mode: octave *** %# End: *** Modified: trunk/octave-forge/main/odepkg/inst/odepkg_examples_dae.m =================================================================== --- trunk/octave-forge/main/odepkg/inst/odepkg_examples_dae.m 2008-03-14 13:16:53 UTC (rev 4748) +++ trunk/octave-forge/main/odepkg/inst/odepkg_examples_dae.m 2008-03-14 22:24:37 UTC (rev 4749) @@ -62,7 +62,7 @@ %! endfunction %! %! vopt = odeset ('Mass', @fmass, 'NormControl', 'on'); -%! vsol = ode2r (@frobertson, [0, 1e11], [1, 0, 0], vopt); +%! vsol = ode2r (@frobertson, [0, 1e5], [1, 0, 0], vopt); %! plot (vsol.x, vsol.y); %!demo @@ -77,7 +77,7 @@ %! %! vopt = odeset ('Mass', [1, 0, 0; 0, 1, 0; 0, 0, 0], ... %! 'NormControl', 'on'); -%! vsol = ode5r (@frobertson, [0, 1e11], [1, 0, 0], vopt); +%! vsol = ode5r (@frobertson, [0, 1e5], [1, 0, 0], vopt); %! plot (vsol.x, vsol.y); %# Local Variables: *** Modified: trunk/octave-forge/main/odepkg/inst/odepkg_examples_ide.m =================================================================== --- trunk/octave-forge/main/odepkg/inst/odepkg_examples_ide.m 2008-03-14 13:16:53 UTC (rev 4748) +++ trunk/octave-forge/main/odepkg/inst/odepkg_examples_ide.m 2008-03-14 22:24:37 UTC (rev 4749) @@ -29,7 +29,8 @@ '\n', ... ' (1) Solve the "Robertson problem" with solver "odebdi"\n', ... ' (2) Solve another "Robertson implementation" with solver "odekdi"\n', ... - ' (3) Solve an "Van der Pol" implementation with solver "odebdi"\n', ... + ' (3) Solve a stiff "Van der Pol" implementation with solver "odebdi"\n', ... + ' (4) Solve a stiff "Van der Pol" implementation with solver "odekdi"\n', ... '\n', ... ' Note: There are further IDE examples available with the OdePkg\n', ... ' testsuite functions.\n', ... @@ -39,7 +40,7 @@ ' your patch to the OdePkg developer team.\n', ... '\n' ]); vode = input ('Please choose a number from above or press <Enter> to return: '); - clc; if (vode > 0 && vode < 4) + clc; if (vode > 0 && vode < 5) %# We can't use the function 'demo' directly here because it does %# not allow to run other functions within a demo. vexa = example (mfilename (), vode); @@ -59,7 +60,7 @@ %! endfunction %! %! vopt = odeset ("NormControl", "on"); -%! vsol = odebdi (@firobertson, [0, 1e11], [1, 0, 0], [-4e-2, 4e-2, 0], vopt); +%! vsol = odebdi (@firobertson, [0, 1e5], [1, 0, 0], [-4e-2, 4e-2, 0], vopt); %! plot (vsol.x, vsol.y); %!demo @@ -73,7 +74,7 @@ %! endfunction %! %! vopt = odeset ("NormControl", "on"); -%! vsol = odekdi (@firobertson, [0, 1e11], [1, 0, 0], [-4e-2, 4e-2, 0], vopt); +%! vsol = odekdi (@firobertson, [0, 1e5], [1, 0, 0], [-4e-2, 4e-2, 0], vopt); %! plot (vsol.x, vsol.y); %!demo @@ -86,10 +87,23 @@ %! mu * (1 - vy(1)^2) * vy(2) - vy(1) - vyd(2)]; %! endfunction %! -%! vopt = odeset ("NormControl", "on", "RelTol", 1e-8); +%! vopt = odeset ("NormControl", "on", "RelTol", 1e-8, "MaxStep", 1e-2); %! vsol = odebdi (@fvanderpol, [0, 20], [2; 0], [0; -2], vopt, 10); %! plot (vsol.x, vsol.y); +%!demo +%! # Solve the "Van der Pol" problem that is given as a function +%! # handle to an implicite differential equation implementation. +%! +%! function [vres] = fvanderpol (vt, vy, vyd, varargin) +%! mu = varargin{1}; +%! vres = [vy(2) - vyd(1); +%! mu * (1 - vy(1)^2) * vy(2) - vy(1) - vyd(2)]; +%! endfunction +%! +%! vsol = odekdi (@fvanderpol, [0, 1000], [2; 0], [0; -2], 500); +%! plot (vsol.x, vsol.y); + %# Local Variables: *** %# mode: octave *** %# End: *** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |