Wednesday, August 23, 2017

Two curves in one coordinate system

Two curves in one coordinate system


Octave

% Octave code to plot the function, 
% y = x.^2 and y = x.^-2
% in the domain of, [-4, 4]
close all
x = -4:.1:4;
y1 = x.^2;
y2 = -x.^2;

h = plot(x, y1, -b, x, y2, :c)
grid on
xlabel(x), ylabel(y), axis([-4, 4, -20, 20])
text(-.5, 5, f(x) = x^2)
set (h(1), "linewidth", 3)
set (h(2), "linewidth", 3)

text(-.5, -5, f(x) = -x^2)

print -deps twoPlots.eps
print -dpng twoPlots.png set (h(1), "linewidth", 10)


Maple

plotx2, ?x2, x=?4..4;


download file now