Working with Octave on Fedora 26

Octave is a free alternative to Matlab to process numerical computation that offers built-in plotting and visualization tools to evaluate the behaviour or formulas and powerful equations. According with its official Website, it is multi platform and it also contains many compatible scripts with Matlab.

It is useful in the academic field to students, teachers and researchers to demonstrate and make interpretations of their calculations graphically.

Launching Octave

Using a terminal on Fedora 26, you might type octave to start its use. In case you do not have it installed, a message to ask you to install is going to be displayed. Then you could type y or Y to allow Octave installation.

You might also want to check what version of Octave you have installed:


Graphing a Trigonometric Function

To graphic the basic sine function, type the following commands in the interactive mode, which is presented with the prompt >>

>> x = -10:0.1:10;
>> plot (x, sin (x));

After an enter, a figure of the sine function will appear with the range and parameters previously defined (-10,10). The fine of the graphic is set with 0.1.













Formatting the axes on a graph

You might want to add axes in the graphic for a better explanation. In this case we can set the labels of both axes by defining the range of X and the value of Y

>> xlabel ("-10 ≤ x ≤ 10");
>> ylabel ("Y = sin (x)");

Click on the Refresh button to update the graphic of the sine formula:

Formatting numeric values and a title on a graph

Locate points where slope becomes most steep is important to detect in functions to explain. In this case we are going to draw two points in 1 and 6:

>> text(1,sin(1),'This is my Point')
>> text(6,sin(6),'This is another Point')

Then you can find the position of the points relative to the sine function:












Now we might add a title on this graphic with:

>> title('Sine Wave')

Adding a second trigonometric

To add another formula in the same graphic, you might type figure to create a new figure. Then, we are going to draw the cos function to plot it later:

>> figure
>> z = cos(x);
>> plot(x,z);












Now, we can present them together by using the hold on command and then call the sine function as it was plotted previously:

>> hold on
>> plot(x,sin(x));












Fine tuning to give the final touch

Colours can , width and a legend can be added to present our work in an article. Please apply the following commands to have the last draft:

>> plot (x,sin(x),'b', 'LineWidth',4);
>> plot (x,z,'r', 'LineWidth',4);
>> legend('cosine','sine')
>> title('Sine and Cosine Wave on Fedora 26')












You can also define maths elements (matrix, equations or vectors) to work with other values and equations to finally plot them in a 2D or 3D graphic.

About Julita Inca

Ingeniero de Sistemas UNAC, Magíster en Ciencias de la Computación PUCP, Magíster en Computación de Alto Rendimiento de la Universidad de Edimburgo, OPW GNOME 2011, Miembro de la GNOME Foundation desde el 2012, Embajadora Fedora Perú desde el 2012, ganadora del scholarship of the Linux Foundation 2012, experiencia como Admin Linux en GMD y Especialista IT en IBM, con certificaciones RHCE, RHCSA, AIX 6.1, AIX 7 Administrator e ITILv3. Experiencia académica en universidades como PUCP, USIL y UNI. Leader of LinuXatUNI Community, HPC Software Specialist at UKAEA, and reviewer of the Technological Magazine of ESPOL-RTE, and volunteering Linux training for MINSA Peru... a simple mortal, just like you!
This entry was posted in τεχνολογια :: Technology. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s