Search All of the Math Forum:

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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

 Messages: [ Previous | Next ]
 Steven Lord Posts: 18,038 Registered: 12/7/04
Re: Problem with program FEM
Posted: Sep 16, 2013 11:39 AM

"Ricardo Tamarín" <tamarin_091@hotmail.com> wrote in message
news:l162lv\$6f4\$1@newscl01ah.mathworks.com...
> 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

--
Steve Lord
slord@mathworks.com
http://www.mathworks.com

Date Subject Author
9/15/13 Ricardo Tamarín
9/15/13 Nasser Abbasi
9/15/13 Ricardo Tamarín
9/15/13 Nasser Abbasi
9/15/13 Ricardo Tamarín
9/15/13 Nasser Abbasi
9/16/13 Ricardo Tamarín
9/16/13 Steven Lord
9/16/13 Ricardo Tamarín