0

I am trying to plot the following figure in tikz. I have coded a part of the figure. I need some assistance in completing the whole picture. enter image description here

\begin{tikzpicture}
\def\width{10}%
\draw[|->](0,0)to++(\width,0)node[right]{$\beta$};
\draw(0,2)node[rectangle, anchor=south west, fill=gray!75!white, minimum height=1cm, minimum width=\width*1cm](em){}
    (0,5)node[rectangle, anchor=south west, fill=gray!75!white, minimum height=1cm, minimum width=\width*1cm](ray){}
    ;
\draw[thick, name path=raySouth](ray.south east)to (ray.south west);
\draw[thick, name path=rayNorth] (ray.north east)to (ray.north west);
\draw[thick, name path=emSouth] (em.south east)to (em.south west); \draw[thick, name path=emNorth](em.north east)to (em.north west);
%Labels
\draw[dashed](0,0)node[below]{0}to++(0,6) (3,0)node[below]{$k_{0}n_{c}$}to++(0,6) (6,0)node[below]{$k_{0}n_{s}$}to++(0,6) (9,0)node[below]{$k_{0}n_{f}$}to++(0,6);
%Rays
\draw[very thick,<-](1.5,5)to++(245:0.5cm);
\draw[very thick,->](1.5,5)to++(85:1cm);
\draw[very thick,->](1.5,5)++(85:1cm)to++(30:0.5cm);

\foreach \ang[count=\i] in {255,-75}{
    \path[name path=lin](4.5,6.01)to++(\ang:2cm);
    \draw[name intersections={of=lin and rayNorth}]
        (intersection-1) node(a){};
    \draw[name intersections={of=lin and raySouth}]
        (intersection-1) node(b){}; 
    \ifthenelse{\i=1}   
    {\draw[very thick,<-] (a.center)to(b.center);
     \draw[very thick,<-] (b.center)to++(210:0.75);
    }
    {\draw[very thick,->] (a.center)to(b.center);
     \draw[very thick,->] (b.center)to++(-30:0.75); 
    }
}

\foreach \ang[count=\i] in {45}{
    \path[name path=lin](7.5,5.51)to++(\ang:2cm);
    \draw[name intersections={of=lin and rayNorth}]
        (intersection-1) node(a){};
    \path[name path=lin](7.5,5.51)to++(180+\ang:2cm);
    \draw[name intersections={of=lin and raySouth}]
        (intersection-1) node(b){}; 
    \draw[very thick,<-] (a.center)to(b.center);
    \draw[very thick,<-] (b.center)to++(90+\ang:0.75);
    \draw[very thick,->] (a.center)to++(-\ang:0.75);    
}
\end{tikzpicture}
2
\documentclass[tikz]{standalone}
\usepackage{ifthen}
\usetikzlibrary{intersections}
\begin{document}

\begin{tikzpicture}
\def\width{10}%
\draw[|->](0,0)to++(\width,0)node[right]{$\beta$};
\draw(0,2)node[rectangle, anchor=south west, fill=gray!75!white, minimum height=1cm, minimum width=\width*1cm](em){}
    (0,5)node[rectangle, anchor=south west, fill=gray!75!white, minimum height=1cm, minimum width=\width*1cm](ray){}
    ;
\draw[thick, name path=raySouth](ray.south east)to (ray.south west);
\draw[thick, name path=rayNorth] (ray.north east)to (ray.north west);
\draw[thick, name path=emSouth] (em.south east)to (em.south west); \draw[thick, name path=emNorth](em.north east)to (em.north west);
%Labels
\draw[dashed](0,0)node[below]{0}to++(0,6) (3,0)node[below]{$k_{0}n_{c}$}to++(0,6) (6,0)node[below]{$k_{0}n_{s}$}to++(0,6) (9,0)node[below]{$k_{0}n_{f}$}to++(0,6);
%Rays
\draw[very thick,<-](1.5,5)to++(245:0.5cm);
\draw[very thick,->](1.5,5)to++(85:1cm);
\draw[very thick,->](1.5,5)++(85:1cm)to++(30:0.5cm);

\foreach \ang[count=\i] in {255,-75}{
    \path[name path=lin](4.5,6.01)to++(\ang:2cm);
    \draw[name intersections={of=lin and rayNorth}]
        (intersection-1) node(a){};
    \draw[name intersections={of=lin and raySouth}]
        (intersection-1) node(b){}; 
    \ifthenelse{\i=1}   
    {\draw[very thick,<-] (a.center)to(b.center);
     \draw[very thick,<-] (b.center)to++(210:0.75);
    }
    {\draw[very thick,->] (a.center)to(b.center);
     \draw[very thick,->] (b.center)to++(-30:0.75); 
    }
}

\foreach \ang[count=\i] in {45}{
    \path[name path=lin](7.5,5.51)to++(\ang:2cm);
    \draw[name intersections={of=lin and rayNorth}]
        (intersection-1) node(a){};
    \path[name path=lin](7.5,5.51)to++(180+\ang:2cm);
    \draw[name intersections={of=lin and raySouth}]
        (intersection-1) node(b){}; 
    \draw[very thick,<-] (a.center)to(b.center);
    \draw[very thick,<-] (b.center)to++(90+\ang:0.75);
    \draw[very thick,->] (a.center)to++(-\ang:0.75);    
}
\draw[thick,variable=\x,domain=1.2:2,samples=50] plot ({1.5+0.5*cos(800*(\x-2))},{\x});
\draw[thick,variable=\x,domain=2:3,samples=50] plot ({1.5+0.5*cos(1200*(\x-2))},{\x});
\draw[thick,variable=\x,domain=3:3.6,samples=50] plot ({1.5+0.5*cos(800*(\x-2))},{\x});
%
\draw[thick,variable=\x,domain=1:2,samples=50] plot ({4.5+0.5*cos(700*(\x-1.9))},{\x});
\draw[thick,variable=\x,domain=2:3,samples=50] plot ({4.5+0.5*cos(1200*(\x-1.9))},{\x});
\draw[thick,variable=\x,domain=3:3.1,samples=50] plot ({4.5+0.5*cos(1200*(\x-1.9))},{\x});
\draw[thick,variable=\x,domain=3.1:3.7,samples=50] plot ({4.2+0.8*exp(5*(3.1-\x)))},{\x});
%
\draw[thick,variable=\x,domain=1.2:2,samples=50] plot ({7.5+0.5*exp(5*(\x-2))},{\x});
\draw[thick,variable=\x,domain=2:3,samples=50] plot ({7.5+0.5*cos(1100*(\x-2))},{\x});
\draw[thick,variable=\x,domain=3:3.8,samples=50] plot ({7.5+0.5*exp(-5*(\x-3))},{\x});

\end{tikzpicture}
\end{document}

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.