In your script trapezoid, the function trapezoid is treated as a local function and hence, it cannot have same name as that of script.
clc % This is treated as command to be executed and trapezoid, func are local function
function f_int=trapezoid(ta,tb,n)
% code
end
function fv=func(t)
% code
end
This issue can be ressolved in two ways
- You may remove clc from the script
- You may change the name of script and call the function after clc command
clc
f_int=trapezoid(ta,tb,n); % Replace ta, tb, n by suitable values
function f_int=trapezoid(ta,tb,n)
% code
end
function fv=func(t)
% code
end