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.

    \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)};
  • That sounds more like a maths (interpolation) question than a TeX question...
    – jub0bs
    Jun 10 '13 at 7:48
  • 1
    @Jubobs How? The function is already completely characterised. It just needs to be scaled, positioned and possibly rotated.
    – Tim N
    Jun 10 '13 at 7:49

A first attempt, far from automatic:


    \node[circle,draw] (A) at (0,0) {A};
    \path (A.east);
    \node[circle,draw] (B) at (3,0) {B};
    \path (B.west);
    \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});


enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.