0

How to draw sine wave graph which starts at (-5, 0.5) and ends at (5, 1.5)?

\begin{tikzpicture}[scale=0.8]

\begin{axis}[xlabel=$x(t)$, ylabel=$t$, grid=major,xmin=-5
xmax=5, ymin=-2, ymax=2, domain=-5:5]
\addplot[blue, line width=1pt, samples=20]
expression{sin(180*x) ??? };
\end{axis}
\end{tikzpicture}
0
2

It seems thatyou like to draw superposition $0.5 + \sin(x)$. This function in pgfplots is {0.5+sin(180*x)}:

enter image description here

\documentclass[margin=3mm]{standalone}
\usepackage{pgfplots}

\begin{document}
    \begin{tikzpicture}
\begin{axis}[
    xlabel=$x(t)$, ylabel=$t$, 
    grid=major,
    xmin=-5, xmax=5, 
    ymin=-2, ymax=2, 
    domain=-5:4.5,
    samples=201]
\addplot[blue, line width=1pt] {0.5+sin(180*x)};
\end{axis}
    \end{tikzpicture}
\end{document}
4
  • Thanks soo much !!
    – user215058
    May 10 '20 at 11:58
  • 1
    @Amy, if you have new question, please ask it as such. In comment will not see it many people, who will know to help you. In question please be more specific, what is your problem.
    – Zarko
    May 10 '20 at 17:52
  • @Amy, if answer help you, you can up-vote it :-) or even accept it :-) :-)
    – Zarko
    May 11 '20 at 15:16
  • It helped, and I up-voted it..sorry for being late..Thank you :)
    – user215058
    May 11 '20 at 20:42

Your Answer

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