Convert meshgrid to vector for 2-value function
<p>I have a function like</p>

<pre><code>f = @(x) x(1).^2 + x(2);
</code></pre>

<p>I want to draw its plot via <code>surf</code>, so I used <code>meshgrid</code> to generate input data:</p>

<pre><code>[x, y] = meshgrid(-2:.2:2);
</code></pre>

<p>But if I try to pass it to the function like this</p>

<pre><code>z = f([x; y])
</code></pre>

<p>I get just a single value in result.</p>

<p>Is there any way to do it except making a function that accepts two parameters (x, y) instead of a vector?</p>