0

I'm trying to draw a sine function going out from a particular point. When I use {sin(x r)} it gives kinked lines. When I use this code I get a lot of errors that say "Package pgf Error No shape named (0 is known. Package TikZ Error Giving up on this path. Did you forget a semicolon?.

Here is my code:

\foreach \x in {0, ..., 16} 
 \draw ((0.05+\x), (3.1+{sin(((pi*\x)/4) r)})) to [out=90*\x, in=(90*(1+\x))] ((0.5+(\x+1)*.25), ({sin((pi*(\x+1)/4) r)}+3.1));

Any advice is greatly appreciated.

LRG
  • 1
  • Welcome! You need to be careful with the parentheses and add multiplication signs * and braces where appropriate. Try \documentclass[tikz,border=3mm]{standalone} \begin{document} \begin{tikzpicture} \foreach \x in {0,...,16} {\draw ({0.05+\x},{3.1+sin(pi*\x/4 r)}) to [out=90*\x, in=90+90*\x] ({{0.5+0.25*(\x+1)}}, {sin(pi*(\x+1/4) r)+3.1});} \end{tikzpicture} \end{document}. There is no error but the output suggests you may have had something different in mind. –  Dec 31 '19 at 18:37
  • https://tex.stackexchange.com/questions/162648/how-to-draw-a-sinewave-in-tikz/162654#162654 – js bibra Jan 01 '20 at 00:41

0 Answers0