GNU Octave is a high-level interactive language, primarily intended for numerical computations, that is mostly compatible with MATLAB®. (Another widely used alternative to Matlab is the Scilab, which seems to be more compatible with Windows platforms but more diverse from Matlab.) The following are the steps of installing Octave 3.6.4 within Cygwin 1.7.17 on Windows 8 Pro.
1. Installation
Use the cygwin setup.exe to select octave, octave-forge (octave-forge is similar to the MATLAB® toolboxes),gnuplot, and xinit packages. Other dependencies, such as xorg-server, will also be installed automatically.
During the installation, there is a error "pango1.0.sh exit code 1". But it does not seem to have caused any obvious issues [1].
2. Configuration
To launch X Window System (X11) and use xterm, the environmental variable DISPLAY should be set in ~/.bashrc.
export DISPLAY=:0
Otherwise, the error "DISPLAY is not set" will occur.
To make sure the plotting works well, run gnuplot in xterm (use "startx" or "xinit" to start X-Windows), and do "plot x w lines" to see whether a figure appears.
There might be strange errors related to "fork()" or .dll loading, after updating or installing packages [2]. This can be resolved by rebasing cygwin files, following the eight steps listed in [3].
3. Testing
As an example, start Octave in xterm, and test the scripts below. Printing and saving plots in Octave are described in [4].
octave:1> plot(sin(1:0.1:10))
octave:2> print -djpg foo.jpg
A prettier xterm may be set according to the steps in [5] (untested).
UPDATE: xterm setting
According to "man startx", when X starts, the configuration file in user's home directory '.xinitrc' will work, in which another configuration file ".Xresources" get called. Contents of both files are as below on my machine:
- .xinitrc
#!/bin/sh xrdb -load $HOME/.Xresources exec xterm -geometry 174x48+0+0 -name login
- .Xresources
Xft*antialias: true Xft*autohint: true XTerm*background: black XTerm*foreground: grey XTerm*cursorColor: grey XTerm*scrollBar: true XTerm*rightScrollBar: true XTerm*saveLines: 10000 XTerm*faceName: Consolas XTerm*faceSize: 10 XTerm*toolBar: off XTerm*trueType: true XTerm*scrollTtyOutput: False
UPDATE2: python plotting in Cygwin
http://blog.csdn.net/lllcfr1/article/details/8628019
===========
[1] http://verahill.blogspot.hk/2013/03/353-cygwin-with-octave-and-gnuplot-on.html
[2] http://cygwin.wikia.com/wiki/Rebaseall
[3] http://stackoverflow.com/questions/9300722/cygwin-error-bash-fork-retry-resource-temporarily-unavailable
[4] http://www.gnu.org/software/octave/doc/interpreter/Printing-and-Saving-Plots.html
[5] http://stackoverflow.com/questions/7811314/change-default-xterm-font-size-in-cygwin