From: Kevin Bachovchin on
I have a function called CalculateE, which determines the electric field given x and y. In another script, I want to integrate this function from x = a to x = b and at a given y. In this script currently I call ETotal = quad(@CalculateE, a, b) to perform the integration in the x-direction. Is there a way using this command that I can pass the (constant) value of y into the function I am integrating?
From: us on
"Kevin Bachovchin" <kbachovc(a)andrew.cmu.edu.edu> wrote in message <hjdog6$9oq$1(a)fred.mathworks.com>...
> I have a function called CalculateE, which determines the electric field given x and y. In another script, I want to integrate this function from x = a to x = b and at a given y. In this script currently I call ETotal = quad(@CalculateE, a, b) to perform the integration in the x-direction. Is there a way using this command that I can pass the (constant) value of y into the function I am integrating?

a hint:

help quad;
% then, peruse the last example, which shows you how to do it...

us