Lets say
y=2; z=4; f=@(x,y,z) x.^2+y.^2+z.^2;
And I want to integrate f for x in [0,1]. It seems like I have to define g and do quad(g,0,1)
g=@(x) f(x,y,z); quad(g,0,1)
The question I have is whether it is possible to do quad on f directly without defining a new function.
Yes ; you can use the anonymous function directly as an argument.
quad(@(x)f(x,y,z),0,1);