1

How can I plot the function/graph below in the picture? My trial was not quite like what it should be enter image description here

\documentclass{standalone}
\usepackage{tikz}
\begin{tikzpicture}[scale=.6]
    \draw[thick, smooth,samples=100,domain=-5.5:5.5] plot(\x,{0.5+1.0/(2.0*(\x))*sin((3*(\x))*180/pi)});
    \end{tikzpicture} 
\end{document}
0
2

Using general marmot logic, I would try something like this.

\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}[scale=.6,declare function={
f(\x)=(1/(1+0.1*abs(\x)))*(cos((3*(\x))*180/pi)+1);}]
    \draw[thick, smooth,samples=101,domain=-5.5:5.5] 
    plot(\x,{3*f(\x)});
\end{tikzpicture} 
\end{document}

enter image description here

This choice emerged from the observations that your plot shows a symmetric function whose local minima are all at the same y-value.

3
  • If course, it is straightforward to add a grid, the axes and the other stuff, if needed. – user121799 Dec 31 '18 at 2:46
  • \draw[->](-6.5,0)--(6.5,0); \draw[->] (0,-.8)--(0,7.5); \foreach\x in {-6, -5, ..., 5,6} \draw(\x, -.2)--(\x, .2); When this is added, how can I change the function so that the minimum points fit the points on the x-axis? – Thumbolt Dec 31 '18 at 4:38
  • @Thumbolt declare function={f(\x)=(1/(1+0.1*abs(\x)))*(cos(\x*180)+1);} or declare function={f(\x)=(1/(1+0.1*abs(\x)))*(cos(\x*90)+1);}. – user121799 Dec 31 '18 at 4:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.