dsolve the second order differential equation in Matlab 7
조회 수: 9 (최근 30일)
이전 댓글 표시
I am a beginner in MATLAB. I've been trying hard to solve the 2nd order ode using dsolve but I get error 'The 'implicit' option is not available when giving Initial Conditions.'
g=9.8;
l=1;
y=dsolve('D2y+(g/l)*sin(y)=0','y(0)=pi/2','Dy(0)=0','t')
I don't know how to solve it. Is it because of my MATLAB version or some other reason? Is there any other way to do it?Everywhere I search in Internet,there are examples which don't work on my MATLAB,may be because they are for newer versions. I didn't get for MATLAB7. Please anyone who could help me with it.
댓글 수: 0
채택된 답변
Walter Roberson
2017년 10월 8일
In all MATLAB versions up to and including R2008a, the Symbolic Toolbox was built around Maplesoft's Maple software package; from R2008b, it was built around MuPAD. For your release, the dsolve documentation is https://www.mathworks.com/help/releases/R14/toolbox/symbolic/dsolve.html -- however if you do not have a current support contract you might not be able to access that old information.
Note: you do
g=9.8;
l=1;
y=dsolve('D2y+(g/l)*sin(y)=0','y(0)=pi/2','Dy(0)=0','t')
then because the 'D2y+(g/l)*sin(y)=0' is a string, the values of g and l are not substituted. When you make assignments like g=9.8 then you are doing that at the MATLAB level, but when the Symbolic Toolbox sees strings with variable names like that, the Symbolic Toolbox looks in its own workspace for definitions of the variables. You can get around this by using:
g=9.8;
l=1;
eqn = subs( subs('D2y+(g/l)*sin(y)=0', 'g', g), 'l', l)
y = dsolve(eqn, 'y(0)=pi/2','Dy(0)=0', 't')
However, this is a difficult equation to solve analytically and you will probably get no solution. You might get an output for
y = dsolve(eqn, 'y(0)=pi/2', 't')
If so then it might look something like,
y(t) = RootOf(-(eval(Int(-5/(49*cos(_a)+25*_C1)^(1/2), _a = 0 .. _Z), {_C1 = RootOf(-(Int(-5/(49*cos(_a)+25*_Z)^(1/2), _a = 0 .. (1/2)*Pi))+_C2)}))+t+_C2)
I might have been able to get slightly further with Maple itself, but even then it was still in the form of a the RootOf an integral.
댓글 수: 2
Walter Roberson
2017년 10월 9일
Notice that you changed equations. You had 'D2y+(g/l)*sin(y)=0' and now you have 'D2y+(g/l)*x=0' . Those behave quite differently. Even 'D2y+(g/l)*sin(x)=0' is easy to deal with compared to 'D2y+(g/l)*sin(y)=0'
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!