I am trying to use the numerical integration function 'integral'
I created a function of four polynomial functions
[x; x^2; x^3; x^4]
now I want to integrate this vector row by row using the integral function. I tried making a function handle for the function and passed it to the 'integral' function
function f = test(x)
f = [x,x^2,x^3,x^4];
end
However, I get the following error when calling it command line:
test_var=@test
integral(test_var,0,1)
Error using ^
One argument must be a square matrix and the other must be a scalar.
Use POWER (.^) for elementwise power.
Error in test (line 2)
f = [x,x^2,x^3,x^4];
Error in integralCalc/iterateScalarValued (line 314)
fx = FUN(t);
Error in integralCalc/vadapt (line 132)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 75)
[q,errbnd] = vadapt(@AtoBInvTransform,interval);
Error in integral (line 88)
Q = integralCalc(fun,a,b,opstruct);