答案1
使用方法如下渐近线以及一些借用自渐近线路径的变换/映射。
% file: foo.tex
% to compile: pdflatex --shell-escape foo
%
% For MikTeX users: Asymptote requires a separate program that cannot be installed
% by the package manager. You can get the installation file from
% https://sourceforge.net/projects/asymptote/files/2.35/
% (specifically, the file ending in setup.exe).
\documentclass[margin=10pt]{standalone}
\usepackage{asypictureB}
\begin{asyheader}
struct planeTransformation {
int nInterpolate = 4;
pair apply(real, real);
pair apply(pair uv) { return apply(uv.x, uv.y); }
transform derivative(real, real);
transform derivative(pair uv) { return derivative(uv.x, uv.y); }
transform linearization(real u, real v) {
return shift(apply(u,v)) * derivative(u,v) * shift(-(u,v));
}
transform linearization(pair uv) {
return linearization(uv.x, uv.y);
}
/* Apply to a single Bezier spline. */
guide _apply(pair p1, pair c1, pair c2, pair p2) {
return apply(p1) .. controls linearization(p1)*c1 and linearization(p2)*c2 .. apply(p2);
}
guide _apply(path g) {
assert((length(g)) == 1);
return _apply(point(g,0), postcontrol(g,0), precontrol(g,1), point(g,1));
}
path apply(path g, int nInterpolate = nInterpolate) {
guide toreturn;
for (int i = 0; i < nInterpolate*length(g); ++i) {
real currentpos = i / nInterpolate;
real nextpos = (i+1) / nInterpolate;
toreturn = toreturn & _apply(subpath(g, currentpos, nextpos));
}
if (cyclic(g)) toreturn = toreturn & cycle;
return toreturn;
}
}
planeTransformation polar;
polar.apply = new pair(real theta, real r) {
return r * expi(theta);
};
polar.derivative = new transform(real theta, real r) {
transform t = (0, 0, -r*sin(theta), cos(theta), r*cos(theta), sin(theta));
return t;
};
\end{asyheader}
\begin{document}
\begin{asypicture}{name=ImplicitPolarGraph}
settings.outformat = "pdf";
import contour;
size(10cm);
real F(real theta, real r) {
return r^2*sin(theta) + sin(theta) - r*theta;
}
real rmax = 2;
path[] xygraphcomponents = contour(F, (-6 pi, -rmax), (6 pi, rmax), new real[] {0}, nx=600, ny=100)[0];
// Draw polar "axes"
for (real r = 1/2; r < rmax; r += 1/2) {
draw(circle(r=r, c=(0,0)), gray + linewidth(0.4),
L=Label("$"+(string)r+"$", black, position=BeginPoint, align=N, filltype=UnFill));
}
draw(circle(r=2, c=(0,0)), black);
for (int degrees = 0; degrees < 360; degrees += 30) {
draw((0,0) -- scale(rmax)*dir(degrees), p=gray + linewidth(0.4), L=Label("$"+(string)degrees+"^{\circ}$", black, position=EndPoint, align=dir(degrees)));
}
for (path xycomponent : xygraphcomponents) {
path rthetacomponent = polar.apply(xycomponent);
draw(rthetacomponent, blue);
}
\end{asypicture}
\end{document}
答案2
作为@egreg建议,你可以用极坐标图绘制数据。假设你想绘制r = sin(2a)
绘制A是角度,r是幅度,
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{pgfplots.polar}
\begin{document}
\begin{tikzpicture}
\begin{polaraxis}
\addplot+[mark=none,domain=0:360,samples=100]
{sin(2*x)};
% the expression is the RADIUS
\end{polaraxis}
\end{tikzpicture}
\end{document}
现在回答你的问题,根据 Matlab,解决方案是
如果角度等于零或 pi,则上述函数未定义。
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{pgfplots.polar}
\begin{document}
\begin{tikzpicture}
\begin{polaraxis}
\addplot+[mark=none,domain=30:80,samples=100]
{ (x + sqrt( (x - 2*sin(x) )*(x + 2*sin(x)) )) /(2*sin(x) };
\end{polaraxis}
\end{tikzpicture}
\end{document}
结果是
答案3
这是函数的图形,将根的表达式简化为
在哪里sinc
是正弦基数。它定义为 sinc θ <= 1/2,θ 不同于 kπ。恰好pst-math
定义了一个SINC
函数,这简化了代码:
\documentclass[11pt, a2paper, pdf, svgnames]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier}
\usepackage{ pst-plot, pst-math}
\usepackage{auto-pst-pdf}
\let\TwoPi\psPiTwo
\let\Pi\psPi
\def\Fone{(1 + sqrt(1-(2*SINC(x))^2))/(2*SINC(x))}
\def\Ftwo{(1 - sqrt(1-(2*SINC(x))^2))/(2*SINC(x))}
\begin{document}
\psset{arrowinset=0.15, ticksize=2.5pt -2.5pt, labelFontSize=\footnotesize, tickwidth =0.6pt}
\begin{pspicture*}(-11,-10)(11,9)
\psaxes[arrows=->, linecolor=LightSteelBlue, tickcolor=LightSteelBlue, Dx=2,ytrigLabels ,dy = \psPi] (0,0)(-11,-9)(11,9)[$x$,-110][$y$,-140]
\psset{linewidth=1.2pt, plotpoints=200, plotstyle=curve, polarplot, algebraic, labelsep=0.5em}
%First series
\psset{linecolor=IndianRed}
\psplot[arrows=*-]{1.896}{3.14159}{\Fone}%
\psplot{6.28}{9.42}{\Fone}
\psplot{12.57}{15.71}{\Fone}%
\psplot[arrows=*-]{-1.896}{-3.14}{\Fone}%
\psplot{-6.28}{-9.42}{\Fone}%
\psplot{-12.57}{-15.71}{\Fone}
\psset{linecolor=Coral}
\psplot{3.15160}{6.28}{\Ftwo}%
\psplot{9.42}{12.57}{\Ftwo}%
\psplot{-3.15}{-6.28}{\Ftwo}%
\psplot{-9.42}{-12.57}{\Ftwo}%
\psline[linecolor=LightSteelBlue](-11, \TwoPi)(11,\TwoPi)
\psline[linecolor=LightSteelBlue](-11, \Pi)(11,\Pi)
\psline[linecolor=LightSteelBlue](-11, -\Pi)(11,-\Pi)%
\psline[linecolor=LightSteelBlue](-11, -\TwoPi)(11,-\TwoPi)
%Second series
\psset{linecolor =OliveDrab }
\psplot{1.896}{3.14160}{\Ftwo}
\psplot{-1.896}{-3.14160}{\Ftwo}
\psplot{6.28}{9.42}{\Ftwo}%
\psplot{-6.28}{-9.42}{\Ftwo}%
\psset{linecolor =DarkSeaGreen}
\psplot{3.14160}{6.28}{\Fone}%
\psplot{9.42}{12.57}{\Fone}%
\psplot{-3.15}{-6.28}{\Fone}%
\psplot{-9.42}{-12.57}{\Fone}%%%
\end{pspicture*}
\end{document}