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

    \draw[thick, smooth,samples=100,domain=-5.5:5.5] plot(\x,{0.5+1.0/(2.0*(\x))*sin((3*(\x))*180/pi)});

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

\begin{tikzpicture}[scale=.6,declare function={
    \draw[thick, smooth,samples=101,domain=-5.5:5.5] 

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.

  • 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.