
Ich habe also nach einer Möglichkeit gesucht, einen Zylinder zu zeichnen, und kann anscheinend keine finden. Wie kann ich aus der folgenden impliziten Funktion Koordinaten erhalten, damit ich sie mit pgfplots zeichnen kann? Oder gibt es eine Möglichkeit, sie mit der Matrixform darzustellen?
$$1=q(x,y,z)=(x,y,z) \begin{bmatrix}
2& -1 & -1\\
-1 & 2 & -1\\
-1 &-1 &2
\end{bmatrix} (x,y,z)^T$$
Antwort1
Sie können diese Art von unendlich expandierendem entartetem Ellipsoid parametrisieren (das ist Mathematik!). Ich habe das für Sie gemacht.
Die Zylinder müssen zweimal gezeichnet werden, um mit dem falschen 3D zwischen den Plots umzugehen: um die Linie zu haben"innen"der Zylinder.
Ich belasse es als Übung, einen Zylinder auszubauen.
Die Ausgabe
Der Code
\documentclass[12pt,tikz,border=0pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset%{{{
{
mySurface/.style =
{
mesh, % there should be better options : look at the PGFplots manual
opacity=.1,
}
}
%}}}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[
%{{{
width=30cm,
xticklabels=\empty,
yticklabels=\empty,
zticklabels=\empty,
samples = 2, % for the lines
samples y = 100, % for the circles
% limits of the box
xmin = -12, xmax = 12,
ymin = -12, ymax = 12,
zmin = -12, zmax = 12,
unit vector ratio = 1 1 1,
% parametrize the 3d view
view/az=15,
view/h=80,
%length of the cylinder
domain = -8:8,
%}}}
]
\def\X{\r*cos(y)-\r*sin(y) + x}
\def\Y{-\r*cos(y)-\r*sin(y) + x}
\def\Z{2 * \r*sin(y) + x}
\def\r{2}
\addplot3[mySurface,domain y= 90:270] ({\X},{\Y},{\Z});
\def\r{1}
\addplot3[mySurface,domain y= 90:270] ({\X},{\Y},{\Z});
\addplot3[domain=-12:12, samples=2, blue, thick] (x,x,x);
\addplot3[mySurface,domain y= -90:90] ({\X},{\Y},{\Z}); ;
\def\r{2}
\addplot3[mySurface,domain y= -90:90] ({\X},{\Y},{\Z}); ;
\end{axis}
\end{tikzpicture}
\end{document}