Time for action - having multiple graphs in the same figure
1. We start by defining the domain and the coefficients representing the polynomial:
octave:83> x = [-5.5:0.1:2]; c_1 = [2 10.1 0 6]; c_2 = [2 10.1 -10.1 6];
2. We then calculate the ranges of f1 and f2:
octave:84> f_1 = polyval(c_1, x); f_2=polyval(c_2, x);
3. And plot the graphs:
octave:85> plot(x, f_1, "linewidth", 5, x, f_2, "linewidth", 5, "color", "red")
After setting the axes limits, font sizes, and so forth, the figure window looks like the next figure below.
What just happened?
From Command 85, we see that plot
can plot many graphs in a single call, and that you can even specify the properties and values of each graph.
Alternatively, you can use the command hold on
to force Octave to not delete the existing graph(s); that is, instead of Command 85, you can use:
octave:86> plot(x, f_1, "linewidth", 5); octave:87> hold on octave:88> plot(x, f_2, "linewidth", 5, "color", "red")
When you want Octave to stop "holding...