How do functions really work in MATLAB?
<pre><code>function [dhdt, x] = velocity(t, h)
    dhdt = -9.8 * t;
    x = 4 * t;
end
</code></pre>

<p>So this is basically my function (with filename <code>velocity.m</code>). At first I thought that what's between the brackets <code>[]</code> would be the output. When I typed in the Command Window I only got one answer.</p>

<pre><code>velocity(1)

%//  -9.8
</code></pre>

<p>I expected to get a two-element vector containing both <code>dhdt</code> and <code>x</code></p>

<pre><code>velocity(1)
%//  -9.8  4
</code></pre>

<p>Why is this?</p>