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.
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.
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));
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)");
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.