function Q4(f,n,a,b)
h = (b-a)/n;
S=0;
for k = 1:n,
S = S+f(a+h*(k-1/2));
end
S = h*S
把數值代入函數f(x)時出現了
Attempted to access f(0.5); index must be a positive integer or logical.
請問該如何把非整數數值代入方程f(x)呢?
更新1:
但f是用戶在call function時輸入的argument 那該如何處理?