view demo.m @ 5018:1c65a8e44ef9 ss-2-1-59

[project @ 2004-09-22 03:33:29 by jwe]
author jwe
date Wed, 22 Sep 2004 03:33:29 +0000
parents 4a9feb849125
children
line wrap: on
line source

# Octave demo

# This is not a function file.
1;

function demo_clear ()
  clc ();
endfunction

function demo_set_term ()
  term = getenv ("TERM");
  display = getenv ("DISPLAY");
  if (! strcmp (term, "xterm") || columns (display) == 0)
    graphics_terminal = input ("enter graphics terminal type: ", "s");
    command = sprintf ("set term %s", graphics_terminal);
    eval (command);
  endif
endfunction

function demo_graphics ()
  demo_clear ();
  demo_set_term ()
  demo_clear ();
  printf ("Graphics\n");
  fflush (stdout);
  sombrero (31);
  pause (10);
  printf ("press return to continue\n");
  fflush (stdout);
  pause ();
endfunction

function demo_linear_algebra ()
  demo_clear ();
  printf ("Solving Linear Algebra Problems\n");
  fflush (stdout);
  pause  ();
endfunction

function demo_odes ()
  demo_clear ();
  printf ("Solving ODEs and DAEs\n");
  fflush (stdout);
  pause  ();
endfunction

while (1)

  demo_clear ();

  choice = menu ("Octave\n======\n\n", ...
                 "Graphics", ...
                 "Linear Algebra", ...
                 "ODEs and DAEs", ...
                 "Exit");

  if (choice == 1)
    demo_graphics ();
  elseif (choice == 2)
    demo_linear_algebra ();
  elseif (choice == 3)
    demo_odes ();
  elseif (choice == 4)
    printf ("\nGoodbye and good luck!\n\n");
    fflush (stdout);
    break;
  endif

endwhile