\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
vardef pulse(expr w, h, d) = 
  clearxy; % protect (x,y) values
  x0 = 0; x1 = 1/4w; x2 = 1/2w; x3 = 3/4w; x4 = w;
  y0 = 0; y1 = 0; y2 = h; y3 = d; y4 = d;
  z0 .. 1/2[z0, z1] .. controls z1 
     .. 1/2[z1, z2] .. controls z2 
     .. 1/2[z2, z3] .. controls z3 
     .. 1/2[z3, z4] .. z4
enddef;
path p; p = pulse(300, 100, -40); draw p withcolor 1/2 blue;

picture pcon; pcon = image(
  draw point 0 of p -- postcontrol 1 of p -- postcontrol 2 of p -- postcontrol 3 of p -- point 5 of p
          dashed withdots scaled 1/2 withcolor 2/3 red;
  for i=1 upto 3: draw postcontrol i of p withpen pencircle scaled 2 withcolor 2/3 red; endfor
  label.lrt("$z_1$", postcontrol 1 of p) withcolor 2/3 red;
  label.top("$z_2$", postcontrol 2 of p) withcolor 2/3 red;
  label.llft("$z_3$", postcontrol 3 of p) withcolor 2/3 red;
  draw p withcolor 1/2 blue;
  for i=0 upto length p: draw point i of p withpen pencircle scaled 2; endfor
); draw pcon shifted 120 down;

endfig;
\end{mplibcode}
\end{document}
