Beginner's help for a graphic for a free physics textbook

Ben Abbott bpabbott at mac.com
Tue Mar 31 13:53:44 CDT 2009


On Tuesday, March 31, 2009, at 11:33AM, "Christoph Schiller" <cs at motionmountain.net> wrote:
>With permission form the original author I would like to produce an
>improved version of the animated graphic shown at
>http://en.wikipedia.org/wiki/File:Snells_law_wavefronts.gif
>
>I'd like to add the animation to my 1600 page physics textbook in pdf  
>format
>that I offer on the internet for free.
>The original graphics was made in MATLAB (the code is given below.)
>
>I have Mac OSX 10.5.6 and downloaded and installed Octave
>just to produce this graphic. So I have a few questions (I have never
>used either Octave nor MATLAB):
>
>1 - Does the code shown below run on Octave?
>2 - How do I input a command file in Octave? (I did not find this in  
>the help files)
>3 - Will I be able to produce and save the gif on OSX or do I need  
>other packages?
>
>(Here is what I plan to change in the graphics of Snell's law:
>- introduce a shaded region in blue to show where the water is
>- take out the grey line (becomes unnecessary)
>- make the blue lines green (to contrast with the blue water)
>- make the wave front lines half the thickness they are now (will be  
>more pretty)
>)
>
>Any help will be appreciated by the readers world-wide - thank you in  
>advance!
>
>Best regards

I needed to modify the saveas command to use the print command instead. As you desire an eps file, the driver option should be changed from postscript (ps) to eps.

-      saveas(gcf, file, 'psc2')

+      print (gcf, file, '-depsc2')

To run your m-file, save your Octave program (actually is a function) to "main.m". Run octave from the directory containing main.m and type "main" at the prompt.

I'm running Octave on OSX, and have "convert" installed via the Fink package manager. Fink can install Gimp for you as well. In order to see the animate gif on OSX, open it with your web browser.

If you need (desire) a *nix package manager for OSX, the two popular choices are Fink and DarwinPorts.

    http://www.finkproject.org/
    http://darwinports.com/

There is a comparison at the link below

    http://abstract.cs.washington.edu/wiki/index.php/Mac_Users:DarwinPorts_vs_Fink

Ben


More information about the Help-octave mailing list