Skip to content

Instantly share code, notes, and snippets.

@daseyb
Last active June 6, 2016 11:43
Show Gist options
  • Save daseyb/86eec7d12292fd211566f295409f6890 to your computer and use it in GitHub Desktop.
Save daseyb/86eec7d12292fd211566f295409f6890 to your computer and use it in GitHub Desktop.
\begin{figure}[htb!]
\begin{centering}
\begin{tikzpicture}
\begin{polaraxis}[xmin=0,xmax=180,ymax=1,
ytick align=outside,
yticklabel style={
anchor=north,
yshift=-2*\pgfkeysvalueof{/pgfplots/major tick length}
}]
\addplot+[mark=f,domain=0:180,samples=600]
{cos(x-90)*(sin(2*x)*cos(2*x) + cos(0.3*x + 1) - sin(30*x)*0.05 + cos(100*x)*0.02)/1.75 };
\addplot+[mark=g,domain=0:180,samples=600]
{cos(x-90)*(sin(2*x)*cos(2*x) + cos(0.3*x + 1))/1.75 };
\addplot+[dashed, polar comb,domain=0:180, samples=6,black,opacity=0.75,mark=x]
{cos(x-90)*(sin(2*x)*cos(2*x) + cos(0.3*x + 1) - sin(30*x)*0.05 + cos(100*x)*0.02)/1.75 };
\addplot+[dashed, polar comb,domain=10:45, samples=3,black,opacity=0.75,mark=x]
{cos(x-90)*(sin(2*x)*cos(2*x) + cos(0.3*x + 1) - sin(30*x)*0.05 + cos(100*x)*0.02)/1.75 };
\addplot+[dashed, polar comb,domain=100:130, samples=4,black,opacity=0.75,mark=x]
{cos(x-90)*(sin(2*x)*cos(2*x) + cos(0.3*x + 1) - sin(30*x)*0.05 + cos(100*x)*0.02 )/1.75 };
\addplot+[dashed, polar comb,domain=105:125, samples=3,black,opacity=0.75,mark=x]
{cos(x-90)*(sin(2*x)*cos(2*x) + cos(0.3*x + 1) - sin(30*x)*0.05 + cos(100*x)*0.02 )/1.75 };
\legend{$f$, $g$}
\end{polaraxis}
\end{tikzpicture}\par
\end{centering}
\caption{Approximating a complicated function $f$ by a simpler function $g$ and sampling $f$ based on the probability distribution of $g$. Note how we are more likely to sample the $f$ in directions where it has a large value.\protect\footnotemark}
\label{fig:importance-sampling}
\end{figure}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment