I need help solving this second order differential equation?
1 view (last 30 days)
Show older comments
I was given a second order function that models longitudinal displacements in a longitudinally loaded elastic bar.
a(x)*u''(x) + a'(x)*u'(x)=f(x), 0 <= x <=1
I know that the left end is at x=0 and the right end is at x=1. So that means:
u(0)=u(1)=0 (does not bend at the ends)
I know a(x) represents both the elastic properties and the cross-sectional area of the bar and u(x) is the displacement at point x.
for the first part I am told that a(x)=1+x and f(x)= 5*sin(2*pi*x)^2 (this is the case where the force is applied symetrically and is strongest at x=.25 and x=.75)
I need to use dsolve to solve for the problem and plot the result on the interval [0,1]
This is what I tried to do:
ode1= 'D2y*(1+x)+ Dy= 5*sin(2*pi*x)^2';
sol=dsolve(ode1,'y(0)=0','y(1)=0');
ezplot(sol)
Howver the graph I got from this just does not look right. Can someone please help me out?
11 Comments
Walter Roberson
on 7 Aug 2011
My mistake earlier: Ei is the Exponential Integral, not the Elliptic Integral. The hypergeometric conversion I showed is still valid, though.
I do see any immediate reason why you would be getting the str2num errors, but I can make the suggestion that you optimize using
t = mfun('Ei', pi*i*[-4, 4, -8, 8, -4*(x+1), 4*(x+1)]);
and then replace the individual mfun calls with t(1), t(2), t(5, t(6), t(1), t(2), t(3), and t(4) respectively.
Answers (1)
Neels
on 7 Aug 2011
My suggestion would be to rearrange the equation as
u''(x) =f(x)/a(x)- u'(x)/a(x)
z = f(x)/a(x)-y/a(x) , where y is first derivative of u(x) and z is first derivative of y. Then solve it using ode45, giving the initial values. I think matlab computes faster using first order derivatives
See Also
Categories
Find more on Oil, Gas & Petrochemical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!