Installing Octave
The following instructions will help you install Octave 3.0.3 on your PC.
Note for Linux users: Most Linux distributions include Octave as standard and if it is not already installed on your system you can install the Octave package from your installation CDs or the Internet. Starting the Octave interpreter under Linux is as simple as typing the ’octave’ command.
Changing Directory in Octave Using the Editor to create Script Files The default text editor in Octave is the SciTE program. To open the editor, just type the command ’edit’ at the prompt. octave-3.0.3.exe:1>edit The editor opens in a new window. You can type up commands you want Octave to run in the Editor and save them in an M-file so that you do not have to type them again if you need to rerun the commands. For example, let’s create the following simple script file to plot a sine wave. Type the following commands in the editor: %Script file to plot a sine wave x=0:0.01:2*pi; plot(x, sin(x)); xlabel(’x’); ylabel(’y=sin x’); Then select File>Save As and save the file as script1.m in your code folder. To run the file, go to the Octave prompt and type octave-3.0.3.exe:2>script1 You should see a figure window with the sine plot. Printing a Figure in Octave To print the plotted figure in encapsulated postscript format, use the following command octave-3.0.3.exe:3>print -depsc graph1.eps This will save the plot as graph1.eps in your code folder. Otherwise, if you would like to copy the figure to a word processor and then print it, go to the figure window and select the icon corresponding to the "Copy the plot to the clipboard" command. You can then paste the plot to your favourite word processor. |