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 ]
Ricardo Tamarín

Posts: 6
Registered: 9/15/13
Problem with program FEM
Posted: Sep 15, 2013 9:32 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello, i have a problem with my program
function y=diri(a,b,n)
h=(b-a)./(n+1);
x=a:h:b;
f=pi^2.*sin(pi.*x);
f=@(x)pi.^2.*sin(pi.*x);
for i=1:n
e1=(x-x(i))/(x(i+1)-x(i));
e1=@(x) (x-x(i))/(x(i+1)-x(i));
e2=(x(i+2)-x)/(x(i+2)-x(i+1));
e2=@(x) (x(i+2)-x)/(x(i+2)-x(i+1));
F=quad(f(x).*e1(x),x(i),x(i+1))+quad(f(x).*e2(x),x(i+1),x(i+2));
end

I get the following error

??? Error using ==> fcnchk at 108
FUN must be a function, a valid string expression, or an inline function object.

Error in ==> quad at 66
f = fcnchk(funfcn);

Error in ==> diri at 16
F=quad(f(x).*e1(x),x(i),x(i+1))+quad(f(x).*e2(x),x(i+1),x(i+2));

Please help me.

Thanks.



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

[Privacy Policy] [Terms of Use]

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