一直尝试为此编写代码,但迄今为止尚未成功,而且我没有时间尝试使其工作。
我迄今为止写的东西。
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[domain=-3.78:4],[domain=0:7]
\draw [->] (-4,0) -- (7,0)node [right] {$x$};
\draw [->] (0,0) -- (0,7)node [above] {$y$};
\draw (1,3)to[in=30, out=45](3,3);
\draw [color=black] plot(\x,{0.45*\x+1.7});
\draw [color=black] plot(\x,{1.5*\x-1.3});
\draw (2.875,2.986)-- (2.875,0);
\draw (4.86,5.99)-- (4.86,0);
\end{tikzpicture}
\end{document}
我不知道如何添加标签、角度、适当的曲线和使角度 \theta 继续位于 x 轴下方的线,但我不想这样。
答案1
您问题中的图像中的线条现在清晰可见,因此某些线条的样式可能不正确:
mwe(最小工作示例)应该是不言自明的......首先绘制轴,然后绘制三角形、切线和曲线的末端。对于曲线使用hobby
库。为此确定四个点(A:起点,B:终点,P 由切线和三角形的交点确定,Q 由三角形确定。对于角度标签使用库angles
和quotes
。
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{angles,
hobby,
intersections,
quotes}
\begin{document}
\begin{tikzpicture}[
every label/.style = {circle, label distance=2pt, fill=white, inner sep=2pt},
my angle/.style = {draw,<->,
angle radius=12mm,angle eccentricity=1.2}
]
% axis
\draw [->] (-4,0) -- (7,0) node [right] {$x$};
\draw [->] (0,-1) -- (0,0) coordinate[label=below:O] (O)
-- (0,7) node [above] {$y$};
% triangle
\draw[name path=A]
(1,0) coordinate[label=below:L] (L) --
(6,6) coordinate[label=right:Q] (Q) --
(Q |- O) coordinate[label=below:M] (M);
% tangent
\draw[name path=B]
(-3,0) coordinate[label=below:T] (T) -- ( 7,4);
% intersections
\path [name path=C]
( 3,0) coordinate[label=below:N] (N) -- + (0,7);
\path [name intersections={of=A and B, by={P,H}}]
node[above] at (P) {P};
node[below right] at (H) {H};
\draw[densely dashed]
(P |- O) node[below] {N} --
(P) node[above] {P};
% curve
\coordinate (A) at (1,2); % start of curve
\coordinate (B) at (6.2,7); % end of curve
\draw [red, densely dotted, very thick, use Hobby shortcut]
([out angle=5, in angle=265] A) .. (P) .. (Q) .. (B);
% angles
\pic [my angle, "$\psi$"] {angle = M--T--H};
\pic [my angle, "$\theta$"] {angle = M--L--Q};
\end{tikzpicture}
\end{document}
答案2
这是替代方案Zarko 的精彩回答。它稍微短一些(Zarko 可能会说“更简洁”,但我不想这样称呼我自己的答案 ;-),有一种不同的方法来猜测你的函数(它取一条穿过 P 和 Q 的弧),并且绝对坐标较少,因此可以说更改它更直接。最重要的是,边距是3.14mm
而不是3mm
;-)
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{angles,quotes,calc}
\begin{document}
\begin{tikzpicture}[domain=0:7]
\draw [-latex] (-4,0) -- (7,0)node [right] {$x$};
\draw [-latex] (0,0) -- (0,6.5)node [above] {$y$};
\draw[thick,densely dotted] (5,0) coordinate[label=below:$M$] (M)
-- ++ (0,6) coordinate[label=above right:$Q$] (Q)
coordinate[pos=0.7,label=below right:$H$] (H);
\draw[thick] (-2,0) coordinate[label=below:$T$] (T) -- (H);
\draw[thick] (1,0) coordinate[label=below:$L$] (L) -- (Q);
\draw[thick,densely dotted] (intersection cs:first line={(L)--(Q)},
second line={(H)--(T)}) coordinate[label=above:$P$] (P)
-- (P|-M) coordinate[label=below:$N$] (N);
\path (P) -- (Q) coordinate[midway] (PQ);
\coordinate[overlay] (aux) at ($ (PQ)!4cm!90:(Q) $);
\draw[blue,thick,densely dotted] let \p1=(P),\p2=(Q),\p3=(aux),
\n1={veclen(\x1-\x3,\y1-\y3)},\n2={atan2(\y3-\y1,\x3-\y1)-180},
\n3={atan2(\y3-\y2,\x3-\y2)-180} in \pgfextra{\typeout{\n1,\n2,\n3}}
(P) arc(\n2:\n3+10:\n1) (P) arc(\n2:\n2-15:\n1);
\draw pic ["$\psi$",angle eccentricity=1.33,draw,-,angle radius=6mm]
{angle = M--T--H};
\draw pic ["$\theta$",angle eccentricity=1.33,draw,-,angle radius=6mm]
{angle = M--L--Q};
\end{tikzpicture}
\end{document}