I need help solving this second order differential equation?

7 Ansichten (letzte 30 Tage)
Robin
Robin am 7 Aug. 2011
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 Kommentare
Robin
Robin am 7 Aug. 2011
ok so I tried to replace what I had for that long solution with mfun, but I get an error:
>> y=(5*x)/2 - (5*log(x + 1))/2 + (5*i*mfun('Ei',((-4)*pi*i)) - 5*i*mfun('Ei',(4*pi*i)))/(16*pi) - (5*i*mfun('Ei',((-4)*pi*i*(x + 1))))/(16*pi) + (5*i*mfun('Ei',(4*pi*i*(x + 1))))/(16*pi) - (log(x + 1)*(40*pi - 40*pi*log(2) + 5*i*mfun('Ei',((-4)*pi*i)) - 5*i*mfun('Ei',(4*pi*i)) - 5*i*mfun('Ei',((-8)*pi*i)) + 5*i*mfun('Ei',(8*pi*i))))/(16*pi*log(2))
??? Error using ==> str2num at 33
Requires string or character array input.
Error in ==> mfun>computeX at 72
x = str2num(x); %#ok
Error in ==> mfun at 43
[x,siz,nans] = computeX(varargin{:});
Walter Roberson
Walter Roberson am 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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Neels
Neels am 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
  1 Kommentar
Robin
Robin am 7 Aug. 2011
I did try to rearrange the equation every way I could think of, but I still get the same nasty result with "Ei" as part of the answer. We have to solve it symbolically, using dsolve, the problem specifically says to do that :(

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by