提问于:
浏览数:
3254
4 回答
3
<p>回答问题的初衷是壮大社区,而不是当工具人,你这种开局一张图,完全没有自己的努力,说实话建议你去淘宝店。</p><p><br></p><p>图我自己闲着没事画了,但是基于上面的原因,我觉得你至少自己打一遍算是给我自己一个安慰好歹让别人学了点东西吧。</p><p><img src="/data/ueditor/php/upload/image/20200505/1588651187600449.png" title="1588651187600449.png" alt="Screenshot from 2020-05-05 11-53-31.png" style="max-width:650px"></p><p><img src="/data/ueditor/php/upload/image/20200505/1588651144335754.png" title="1588651144335754.png" alt="Screenshot from 2020-05-05 11-40-41.png" style="max-width:650px"></p><p><img src="/data/ueditor/php/upload/image/20200505/1588651153802819.png" title="1588651153802819.png" alt="Screenshot from 2020-05-05 11-40-53.png" style="max-width:650px"></p><p><img src="/data/ueditor/php/upload/image/20200505/1588651167154971.png" title="1588651167154971.png" alt="Screenshot from 2020-05-05 11-41-00.png" style="max-width:650px"></p><p><img src="/data/ueditor/php/upload/image/20200505/1588651175236561.png" title="1588651175236561.png" alt="Screenshot from 2020-05-05 11-41-06.png" style="max-width:650px"></p><p><br></p>
-
哈哈哈哈必须点赞 – zhaochongbin 2020-05-06 23:57 回复
2
<p>感觉使用tkz-fct宏包加gnuplot,也是可以的,用楼上的数据,写了一下:</p><pre class="brush:plain;toolbar:false">\documentclass[12pt, border = 8pt, varwidth, convert]{standalone}
\usepackage{tkz-fct}
\usepackage{tkz-euclide}% 绘制线段命令(此处仅标注尺寸)
\begin{document} %在document环境中撰写文档
\begin{tikzpicture}
% 定义坐标区域
\tkzInit[xmin=-1, xmax=8, ymin=0, ymax=5.5]
% 绘制坐标轴
\tkzDrawXY[noticks]
% 绘制曲线
\tkzFct[thick,color=cyan, domain=1:6.5]{sin(pi/3*(x-1))+3}
% 定义坐标点
\tkzDefPointByFct(1) \tkzGetPoint{a}
\tkzDefPointByFct(6.5) \tkzGetPoint{b}
\tkzDefPointByFct(4.4) \tkzGetPoint{c}
\tkzDefPoint(4.4,0){d}
\tkzDefPointByFct(3.9) \tkzGetPoint{e}
% 绘制线段
\draw[thick, red](1,0) -- (a);
\draw[thick, red](6.5,0) -- (b);
% 标记各个点
\tkzLabelPoint[below](1,0){$a$}
\tkzLabelPoint[below](6.5,0){$b$}
\tkzLabelPoint[below,shift={(0.0pt, -1.1pt)}](4.4,0){$x$}
\tkzLabelPoint[below right,shift={(-6.0pt, 2.0pt)}](4.7,0){$x+h$}
% 绘制区域
\tkzDrawSegment[dim={$f(x)$,16pt, transform shape}](d,c)
\fill[draw=red, fill=red!50, fill opacity=0.5](c) rectangle (4.7, 0);
% 绘制填充区域
\tkzDrawArea[opacity=0.3, color=cyan!50, domain =1:6.5]
% 绘制函数名称
\draw[black](e)--+(0.7, 0.3)node[anchor=south west, yshift=-3pt]{$y=f(t)$};
\end{tikzpicture}
\end{document}</pre><p>结果为:<br></p><p><img src="/data/ueditor/php/upload/image/20200507/1588834837481896.png" title="1588834837481896.png" alt="main-0.png" style="max-width:650px"></p><p>注意需要安装gnuplot,详情请用texdoc tkz-fct查看其说明书。</p>
0
<p>参考参考 <a href="https://wenda.latexstudio.net/q-2130.html" target="_self">https://wenda.latexstudio.net/q-2130.html</a>,不会是作业吧?<br></p>
0
<pre class="brush:plain;toolbar:false">\begin{tikzpicture}
\colorlet{fillcolor}{cyan!70!gray!10!white}
\colorlet{curvecolor}{cyan!70!black}
\tikzmath{
\ymax=4.5;%y 轴的上端
\xmax=7.5;%x 轴的右端
\sizeA=0.2;%红色矩形框宽度
\sizeB=0.4;%箭头标签上部与曲线的水平间距
\domianL=1;%定义域左端点
\domainR=6.5;%定义域右端点
\samplesN=101;%自变量样本点的个数,个数不能太少
\onestep=(\domainR-\domianL)/(\samplesN-1);%相邻两个自变量样本点的间隔,要让 \onestep 是比较简单的有限数才好
\secondsample=\domianL+\onestep;%第二个自变量样本点
\pA=int(0.5*\samplesN);%一个自变量样本点的序号,对应的点用于添加标签
\pB=int(0.7*\samplesN);%一个自变量样本点的序号,对应的点用于画红色矩形
}
%使用函数 sin(deg(pi/3*(\x-1)))+3 定义坐标点 (p1), (p2), ...... , (p\samplesN)
\foreach \i[count=\j] in {\domianL,\secondsample,...,\domainR}
{\coordinate (p\j) at (\i,{sin(deg(pi/3*(\i-1)))+3});}
%几个需要加标签的点
\begin{scope}[inner sep=0pt,text height=1em]
\path (0,0 -| p1) coordinate (a) node[below]{$a$} ;
\path (0,0 -| p\pB) coordinate (x) node[below left]{$x$};
\path ($(x)+(\sizeA,0)$) coordinate (x+h) node[below right]{$x+h$};
\path (a -| p\samplesN) coordinate (b) node[below]{$b$};
\path (0,0) node[below]{$0$} ;
\end{scope}
%剪切填充色
\begin{scope}
\clip (a) rectangle (x+h |- 0,\ymax);
\fill [fill=fillcolor] (a) \foreach \i in {1,...,\samplesN}{--(p\i)} |- (a);
\end{scope}
%画标识线
\begin{scope}[thick]
\draw [draw=red](a) --(p1);
\draw [draw=red](x+h) rectangle (p\pB);
\draw (p\samplesN) -- (b);
\end{scope}
%画箭头标识
\draw [{Bar[width=6mm]<}->]($(p\pB)+(-\sizeB,0)$) coordinate (t) -- node[fill=fillcolor,inner ysep=0pt,rotate=90]{$f(x)$} (t |- 0,0);
%函数标签
\draw (p\pA) --++(20:0.8) node[right]{$y=f(t)$};
%函数曲线
\draw [draw=curvecolor,thick] (p1) \foreach \i in {2,...,\samplesN}{--(p\i)};
%坐标轴线
\draw [-Stealth,thick](0,0)--(\xmax,0) node [right] {$t$};
\draw [-Stealth,thick](0,0)--(0,\ymax) node [above] {$y$};
\end{tikzpicture}</pre><p><img src="/data/ueditor/php/upload/image/20200510/1589041915794850.png" title="1589041915794850.png" alt="2020-05-10 00-31-44屏幕截图.png" style="max-width:650px"></p><p><br></p><p>这个例子 借用 @lichangkai 的例子里的函数,这是纯粹使用 tikz 的例子,需要多少了解一下 tikz 才好使。<br></p><p>比较起来,用 tkz-fct宏包方便一些,因为这个宏包提供现成的工具。</p>
你的回答
请登录后回答
你的回答将会帮助更多人,请务必认真回答问题。