title: MATLAB R2015a, passing functions as arguments
body: <p>I am using Matlab R2015a (since it has been the easiest to install) and I am starting to learn it. I have to write a function F that is going to take arguments (f,a,b,n) where f is a functions and rest is integers. The logic of the task is not a problem but it is syntax that I am having trouble with. In this version I have to write functions in separate files.</p>
  <p><em>main.m file</em></p>
  <pre><code>res = F(f,1,10,10)
  </code></pre>
  <p><em>F.m file</em></p>
  <pre><code>function Val = F (f,a,b,n)
  X = linspace(a,b,n);
  ValX = f(X); %here I want to call a function f on every element of X but  I get an error
  A = [X ; ValX]; 
  Val = A;
  end 
  </code></pre>
  <p><em>f.m file</em></p>
  <pre><code>function y = f(x)
  y = 3*x+sin(x);
  end
  </code></pre>
  <p><strong>Errors:</strong></p>
  <p>Error using f (line 2) - this is in f.m file</p>
  <p>Not enough input arguments.</p>
  <p>Error in main (line 2)</p>
  <p>res = F(f,1,10,10)</p>