TeX - LaTeX Asked by likeAvirgin on December 24, 2020
Here’s my code:
documentclass[11pt,a4paper]{article}
usepackage[utf8]{inputenc}
usepackage{amsmath}
usepackage{amsfonts}
usepackage{amssymb}
usepackage{pgfplots}
pgfplotsset{width=5cm,compat=1.9}
usepgfplotslibrary{external}
tikzexternalize
begin{document}
begin{tikzpicture}
begin{axis}[
axis lines = box,
xlabel = $x$,
ylabel = {$f(x)$},
]
%Below the red parabola is defined
addplot [
domain=-10:10,
samples=100,
color=red,
]
{x^2 + 2*y^2 - 5 - 44/100};
addlegendentry{$x^2 + 2*y^2 - 5 - 44/100$}
%Here the blue parabloa is defined
addplot [
domain=-10:10,
samples=100,
color=blue,
]
{x^2 - x*y + y};
addlegendentry{x^2 - x*y + y}
end{axis}
end{tikzpicture}
end{document}
I want to plot graphs of these functions:
x^2 + 2y^2 – 5 – 44/100 = 0 and
x^2 – xy + y = 0.
Where are my mistakes?
You want addplot3
for this and decrease the number of samples to not exceed TeX memory. You can also use mesh
or surf
and the width was too small I used width=12cm
.
documentclass[11pt,a4paper]{article}
usepackage{pgfplots}
pgfplotsset{width=12cm,compat=1.9}
usepgfplotslibrary{external}
tikzexternalize
begin{document}
begin{tikzpicture}
begin{axis}[
axis lines = box,
xlabel = $x$,
ylabel = {$f(x)$},
]
% Below the red parabola is defined
addplot3 [
domain=-10:10,
surf,
%samples=50,
color=red,
]
{x^2 + 2*y^2 - 5 - 44/100};
addlegendentry{$x^2 + 2y^2 - 5.44$}
% Here the blue parabloa is defined
addplot3 [
domain=-10:10,
%samples=50,
surf,
color=blue,
]
{x^2 - x*y + y};
addlegendentry{$x^2 - xy + y$}
end{axis}
end{tikzpicture}
end{document}
Answered by AboAmmar on December 24, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP