Skip to content

Instantly share code, notes, and snippets.

@matiskay
Created October 15, 2015 18:50
Show Gist options
  • Save matiskay/95be2216afa8954c117d to your computer and use it in GitHub Desktop.
Save matiskay/95be2216afa8954c117d to your computer and use it in GitHub Desktop.
x = -0.5:0.001:1;
fx = x.^3;
p2 = 0;
plot(x, fx, 'LineWidth', 2);
hold on
grid on
plot(x, p2, 'g', 'LineWidth', 2);
%stem(0.5, 0.5^3, 'r', 'LineWidth', 2)
hold off
title('Quadratic approximation of $f(x) = x^{3}$ in $x_{0} = 0$','interpreter','latex', 'fontsize', 14);
xl = xlabel('$x$');
yl = ylabel({'$f(x)$'});
l = legend('$x^{3}$', '$P_{2}$');
set(xl, 'FontUnits', 'points');
set(xl, 'FontSize', 12);
set(xl, 'interpreter', 'latex');
set(xl, 'FontName', 'Times');
set(yl, 'FontUnits', 'points');
set(yl, 'interpreter', 'latex');
set(yl, 'FontSize', 12);
set(yl, 'FontName', 'Times');
set(l, 'FontSize', 10);
set(l, 'interpreter', 'latex');
set(l, 'FontUnits', 'points');
set(l, 'FontWeight', 'normal');
set(gca,...
'Units', 'normalized',...
'FontUnits', 'points',...
'FontWeight', 'normal',...
'FontSize', 12,...
'FontName', 'Times');
print -depsc2 images/exercise3.eps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment