You've to do either of following
a) pass C
as argument to function simps()
OR
b) evaluate C
from workspace
C = evalin( 'base', 'C' );
inside the function before its use.
Also, use of eval
and evalin
is generally discouraged as it makes your code harder to follow and re-use.
Tip :
You may want to combine both like following
function simps(C)
if nargin == 0
C= evalin( 'base', 'C' );
end
% Your code