GNU Octave and FreeMat are examples of free Software. When we talk of software being free, we are referring to Freedom which is something other than the price. The notion of software freedom is to provide users with the right to use, study, copy, modify, and redistribute modified copies of the software. The GNU General Public License is the instrument that makes Octave and FreeMat free and ensures that each remain free. At the core of Free Software is the notion of people working in community. Think of folks in a frontier settlement, brought together for the sake of a common cause. These communitites includes Universities, national institutions, and professional organizations. In truth, we can choose to work with these communities, otherwise they will exist happily without us.
As a student, the best way that you can contribute and give back to the free software community is by being careful, respectful, providing feedback to your course instructor, and in talking with your classmates being sure to observe the principles of Academic Honesty. You can be most respectful of the Octave and FreeMat communities by directing issues that arise to your course instructor, reading the documentation and the list of frequently asked questions. Be warned that the free software community is NOT a resource for answering homework questions (while normally very friendly, developers are known to bite).
Installing Octave natively on a Windows platform for use at home
Octave has a longer history than FreeMat but despite the various
GUIs developed, Octave itself doesn't come out of the box with a GUI
but it does work with other GUI tools.
Also, be warned that Octave on Windows might prefer that you work on
the C: drive.
Please do not install Octave on lab computers as the
install will not remain on the computer for long.
Start => Programs => GNU Octave => OctaveNext change to your HOME diretory. Octave is very similar to MATLAB so that you can also use it interactively like a calculator. Octave is like MATLAB in that specifying angles radians are assumed. Octave already knows pi.
octave:1> cd octave:2> 5^2 ans = 25 octave:3> cos(pi) ans = -1
The isvarname command asks if a given character string can be used as a variable name. The first character can be a letter or an underscore. The following charecters can only be letters, numbers, or an underscore.
octave:4> isvarname time ans = 1 octave:5> isvarname cool-beans ans = 0
The iskeyword command asks if a given character string is a reserved keyword. Entering the command without a character string causes Octave to list all the keywords. Octave can also make plots of data for you. Try the following:
octave:6> x = [1 2 3 4 5]; octave:7> y = [10 26 24 43 50]; octave:8> plot(x,y)
To edit a file, the edit command starts up a text editor.
You can use this editor to type in, edit, save, and print files. Be sure to save the file to your current working directory. If not, use the cd command in Octave to change to the working directory. To run an Octave script with the name 'FileName.m', just type in 'FileName' at the command prompt.
A so-called script file contains commands that you could otherwise type in by hand. The first concept to master is the notion of the working directory. It is very important that your text editor agree with regard to the working directory.
With regards to the working directory when you login to a CETA lab computer, your account on the college file server should be mounted as the Z: drive. You are also encouraged to bring a memory stick to class. Such a memory stick might be mounted as the F: drive, be sure to examine the file system to see where the memory stick is mounted. The order of the following commands should help you walk through a simple exercise. Note that MATLAB and FreeMat provide a graphical alternative to many of the commands given below.
As an exercise, use the commands above to create a working directory named scripts and create a file named area_circle that contains the following code:
% area_circle.m - Your Name - Today's date % An example exercise script for named-application radius = 10 % cm area_scm = pi * radius^2 area_sm = area_scm/100^2 % end of area_circle.m
Be sure that your script file starts with a comment block containing at least the following items. This is the text that the help command will report to you.
Author: Jonathan Hill
( jmhill at hartford dot edu )
Please Let me know that you read my web pages.
These notes are especially written for Engineering Students at the University of Hartford, CT, USA, however others may also benefit. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the GNU document entitled "GNU Free Documentation License" ( http://www.gnu.org/licenses/fdl.html)
Revised: January 25, 2012 7:06PM EST