title: How to plot Leminscate shape using Matlab?
body: <p>How to plot this Leminscate <code>(−π/4 =&lt; φ =&lt; π/4)</code>?</p>
  
  <pre><code>x = cos(φ)sqrt(2cos(2φ))
  y = sin(φ)sqrt(2cos(2φ))
  </code></pre>
  
  <p>This is my attempt: </p>
  
  <pre><code>x = -pi/4:0.001:pi/4;
  xy = cos(x).*sqrt(2*cos(2.*x));
  yy = sin(x).*sqrt(2*cos(2.*x));
  plot(x,xy,x,yy)
  axis equal
  grid on
  </code></pre>
  
  <p>Result</p>
  
  <p><a href="https://i.stack.imgur.com/0wO8Y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0wO8Y.png" alt="enter image description here"></a></p>