% clean possible leftovers from previous runs clear clf np = 20; x = linspace(0, 1, np); % an array of np equidistant points between 0 and 1 inclusive y = sin(x); z = tan(x); plot(x, y, '.-') % plot y(x), place '.' at every data point, connect points with lines hold on % prepare to add another graph plot(x, z) % default line style grid on xlabel('x') ylabel('f(x)') title('A graph') legend('sin(x)', 'tan(x)', 'location', 'best') hold off