Welcome: lines and a legend Open ↗
Code
% Welcome to MathLab, a MATLAB-style lab in your browser.
% Run with ⌘/Ctrl + Enter. Type 'help' in the console for all functions.
x = linspace(0, 4*pi, 400);
plot(x, sin(x), 'LineWidth', 2)
hold on
plot(x, cos(x), '--')
plot(x, sin(x) .* exp(-x/6), 'LineWidth', 1.5)
hold off
title('Trigonometry, with a little damping')
xlabel('x'), ylabel('y')
legend('sin x', 'cos x', 'e^(-x/6) · sin x')
grid on