title: How to generate a function of two variables without using any loop?
body: <p>Suppose I have a function y(t,x) = exp(-t)*sin(x)</p>
  
  <p>In Matlab, I define</p>
  
  <pre><code>t = [0: 0.5: 5];
  x = [0: 0.1: 10*2*pi];
  y = zeros(length(t), length(x)); % empty matrix init
  </code></pre>
  
  <p>Now, how do I define matrix y <strong>without using any loop</strong>, such that each element y(i,j) contains the value of desired function y at <code>(t(i), x(j))</code>? Below is how I did it using a for loop.</p>
  
  <pre><code>for i = 1:length(t)
      y(i,:) =  exp(-t(i)) .* sin(x);
  end
  </code></pre>