Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Problem with program FEM
Replies: 8   Last Post: Sep 16, 2013 12:52 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 17,945
Registered: 12/7/04
Re: Problem with program FEM
Posted: Sep 16, 2013 11:39 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Ricardo Tamarín" <tamarin_091@hotmail.com> wrote in message
> 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


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.

Steve Lord
To contact Technical Support use the Contact Us link on

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2015. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.