I need help solving this second order differential equation?
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
Robin
on 7 Aug 2011
bym
on 7 Aug 2011
t is the default independent variable, try using:
sol=dsolve(ode1,'y(0)=0','y(1)=0','x');
you'll get a nasty expression involving exponential integrals that EZ plot can't handle
Robin
on 7 Aug 2011
Walter Roberson
on 7 Aug 2011
Ei would be the Elliptic Integral. It is a constant if all of the parameters to it are constants.
i would be the square root of negative 1.
Robin
on 7 Aug 2011
Robin
on 7 Aug 2011
bym
on 7 Aug 2011
Ei is short for exponential integral and i is sqrt(-1)
Walter Roberson
on 7 Aug 2011
http://en.wikipedia.org/wiki/Elliptic_integral
The expression can be converted to the equivalent hypergeometric form,
y(x) = (-5*(-ln(8*Pi)+ln(4*Pi))*(1+x)*hypergeom([1/2],[3/2, 3/2],-4*(1+x)^2*Pi
^2)+(-10*ln(4*(1+x)*Pi)+10*ln(4*Pi))*hypergeom([1/2],[3/2, 3/2],-16*Pi^2)+(5*
ln(4*(1+x)*Pi)-5*ln(8*Pi))*hypergeom([1/2],[3/2, 3/2],-4*Pi^2)+5*ln(4*(1+x)*Pi
)+(-5+5*x)*ln(4*Pi)-5*x*ln(8*Pi))/(-2*ln(8*Pi)+2*ln(4*Pi))
bym
on 7 Aug 2011
you might be able to plot is using subs. You can evaluate the exponential integral using the following:
mfun('Ei',-4i*pi)
ans =
-0.0061 - 3.0630i
Robin
on 7 Aug 2011
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
0 votes
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
Categories
Find more on Mathematics 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!