Tikz graph for sine function of y=sin(2x+pi/3)

by ZEESHAN   Last Updated June 13, 2019 03:23 AM

I am looking to create the sine graph for function y=sin(2x+pi/3), but it looks straight line.

\begin{axis}[axis lines=middle,axis on top,xlabel=$x$,ylabel=$y$,

\addplot []{sin(2*x+pi/3)}; 


Answers 1

By default the arguments of trigonometric functions are in degrees, so you need to convert them from radians to degrees to be able to feed them into the sin function. This can be achieved by wrapping the argument into deg, or by by using trig format=rad.

\begin{axis}[axis lines=middle,axis on top,xlabel=$x$,ylabel=$y$,
 xmin=-4,xmax=4,ymin=-1,ymax=1,ytick=\empty,trig format=rad, %<- 


enter image description here

June 13, 2019 03:32 AM

Related Questions

Updated December 20, 2018 03:23 AM

Updated December 17, 2018 22:23 PM

Updated April 27, 2019 15:23 PM

Updated May 29, 2015 21:10 PM

Updated July 28, 2017 20:23 PM