Octave uses a path hierarchy when searching for files, and it is important to learn how to instruct Octave to look for the files in certain directories. Octave will have to be instructed where to look for these files in order to read them. Later in the book, we will write script and function files. Again, before adding this change to your. This can be done by adding the following line into your. Finally, note that under Windows, the behavior will be global because we instructed Octave to look for this particular. The command edit mode "async" will ensure that when the edit command is given, you can use the Octave prompt without having to close the editor first. Did the appearance of the Octave prompt change? It should look like this. Alternatively, just use your favorite editor to create the file.Įxit the editor and restart Octave. Copy the following lines into the file and save the file as. Start Octave if you have not already done so, and open the default editor. The next time Octave starts it will then execute these commands. After this, we opened the global configuration file and added two commands. Add the following lines at the end of the file. We still need to tell the interpreter that this is now the Octave home directory.
Instead of creating the directory through Octave, you can use, for example, Windows Explorer. If Octave returns a zero value, then some error occurred, and Octave will also print an error message. We can actually create this directory directly from Octave so let us go ahead. You can then command Octave to go to this directory and look for your configuration file here, whenever you start the interpreter. I therefore recommend that you create a home directory for Octave. This can be a good way to test new configurations before. They basically consist of a sequence of Octave commands, so you can also give the same commands to the interpreter from the Octave prompt. The configuration files are named either octaverc or. They can be targeted to work with a specific version of Octave, a specific project, or a user. The changes can be global and affect all users of Octave that run on a particular computer. These files can be changed in order to add system paths, the appearance of the Octave command prompt, how the editor behaves, and much more. When the Octave interpreter starts, it reads several configuration files. Notice that the interpreter keeps track of the number of commands that have been entered and shows this at the prompt. We will discuss Octave functions later in the book. Later we will learn how to label the axis, add text to the figures, and much more. As you might have guessed already, the contourf Octave function plots the contours of f. As a default, Octave calculates the range of f using 50 x and y values in the interval. The graph is then plotted using the Octave function surf. The function value range is evaluated in Octave by the command peaks, which is the nick name for the function f. Therefore, your figures may look a bit different, depending on that program. Octave can use different plotting program, for example, gnuplot or its own native plotting program. The two numbers show the x axis and y axis values. The cross is just the point where you clicked. A cross and two numbers appear in the window if you are using gnuplot with Octave. Click somewhere on the window of the right-hand side figure with button three. If not, it can be because you are using Octave version 3. To maintain the ideal of learning both Octave and Matlab from this tutorial, the differences Octave is available on the MDP Resource CD and can be downloaded from is available in the on-line version of the manual.
Gnu octave beginners guide pdf download.