I want to integrate a given matrix elementwise using quadgk
command, where the entries of my matrix are highly oscillatory functions. It seems the command integral
got the option 'ArrayValued'
, whereas quadgk
doesn't. Here I give a simplified example of what I'm aiming to do - the actual matrix I'm working on is way more complicated and has actually no explicit form, since it's the result of many prior intricate operations of inversions, truncations and multiplications. So here's what I'm doing.
First I define the function my_fun
which generates my matrix in a separate file like this :
function f = my_fun(x)
f = [x x^2];
Next, in the main code I call it and try to integrate it elementwise from, say, 0 to 1 :
x = 0:.01:1;
g = @(x) my_fun(x);
Q = quadgk(g,0,1);
With the command integral
I have no problem doing it, but with quadgk
it doesn't work. Thanks !