# How to plot a curve between two nodes?

I've got two nodes and would like to draw a specific curve between the two nodes, such that the curve begins at the first node and ends at the second node. The curve and its domain are already specified. How can I do that?

In my case, the nodes are at the same vertical position, and the curve that I'm plotting has the value zero at both endpoints. Here is my code with the curve unscaled and unpositioned.

\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[domain=-2*pi:2*pi]
\node (A) at (0,0) {A};
\node (B) at (1,0) {B};
\draw[smooth,samples=200,color=blue] plot function{sin(pi*x)/(pi*x)};
\end{tikzpicture}
\end{document}

• That sounds more like a maths (interpolation) question than a TeX question... Jun 10 '13 at 7:48
• @Jubobs How? The function is already completely characterised. It just needs to be scaled, positioned and possibly rotated. Jun 10 '13 at 7:49

A first attempt, far from automatic:

## Code

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[domain=-2*pi:2*pi]
\node[circle,draw] (A) at (0,0) {A};
\path (A.east);
\pgfgetlastxy{\ax}{\ay}
\node[circle,draw] (B) at (3,0) {B};
\path (B.west);
\pgfgetlastxy{\bx}{\by}
\pgfmathsetmacro{\mydist}{(\bx-\ax)/28.453}
\draw[smooth,samples=200,color=blue,domain=-1:1,shift={($0.5*(A.east)+0.5*(B.west)$)}] plot (\x/2*\mydist,{0.05*sin(\x*1080)/\x});
\end{tikzpicture}
\end{document}