"Ricardo Tamarín" <email@example.com> wrote in message news:firstname.lastname@example.org... > then I don't know how to calculate the integral of the product of > functions in this case, which command do you recommend?
You're doing the opposite of what I called out as a common mistake in this thread:
In this case, you don't want to pass in the product of the two functions as the first input to QUAD. You want to pass in a function that when evaluated returns the product of the values of the two functions.
f = @(x) x+1; g = @(x) x+2; x = 1:10; y = f(x).*g(x) % returns a vector h = @(x) f(x).*g(x) % returns a function handle h(x) % returns a vector
You don't want to pass y into QUAD. You want to pass h into QUAD, so that QUAD can evaluate h at the values of x QUAD chooses.