Generate sinusoidal patterns in Matlab
<p>How can I generate the following <a href="https://i.stack.imgur.com/BB0Fn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BB0Fn.png" alt="image"></a> in Matlab?</p>

<p>and How generates these patterns :
<a href="https://i.stack.imgur.com/XyPxL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XyPxL.png" alt="image2"></a></p>