4

I'm trying to draw a frequency modulated sinusoidal in a polar domain with the following code.

\documentclass[tikz,border=10]{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}

    \def\rad{5.5}
    \def\amp{1.0}
    \def\n{11}
    \def\myphi{90}

    \draw [domain=0:6.29,samples=500,smooth] plot (xy polar cs:angle=\x r,
        radius={\rad+\amp*cos(\n*\x r+sin(\n*\x r+\myphi)+\myphi)});

\end{tikzpicture}

\end{document}

When I compile this, however, the inner sinusoidal is completely ignored. In other words, tikz seems to read the following line instead.

radius={\rad+\amp*cos(\n*\x r+\myphi)});

Why does this happen, and how do I get the intended result?

Edit: Frequency modulation is a mathematical operation which modifies the argument of a function. In my example, the argument of the cosine function is modified by a sine function. As explained, this inner sine function is, for some reason, ignored when I compile the code. I'm curious about why, and I wish to know how I can draw a function where nothing is ignored.

Visualized by Wolfram Alpha, the first image shows the intended function, and the second image shows the function LaTeX compiles. They are not the same.

Edit2: I have shortened and changed the example. It should now be easier to read the function in the code above. Hopefully I didn't remove anything essential.

enter image description here enter image description here

6
  • 2
    All users are not familiar with frequency modulated sinusoidal graph. What do produce your code? Please give us an example.
    – user31034
    Apr 2, 2014 at 22:04
  • 1
    Consider using PGFPlots for doing polar plots: tex.stackexchange.com/questions/146671/…
    – juliohm
    Apr 2, 2014 at 22:12
  • I included the two images of the two figures you linked to. They seem identical to me and identical to the function I get running your MWE (just missing the axis). Apr 2, 2014 at 23:29
  • @Peter, by removing the Wolfram Alpha (WA) links, you also removed the expressions as shown in WA, which should indeed make it clearer that they are not the same.
    – eiterorm
    Apr 2, 2014 at 23:35
  • Have added the links back. Sorry about that. It was difficult for me to see the difference without having them on the same page, and including the images here seems to show that they are same graph. Apr 2, 2014 at 23:36

1 Answer 1

4

I don't think there's anything wrong with tikz. It seems that you have forgotten a r in the formula (to interpret your angle as radians and not degrees):

\draw [domain=0:6.29,samples=500,smooth] plot (xy polar cs:angle=\x r,
       radius={\rad+\amp*cos(\n*\x r+sin(\n*\x r+\myphi) r+\myphi)});

It is precisely the last r appearing on the second line.

result

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .