Solving a System of 2nd Order Linear ODE? "Explicit solutions cannot be found"
2 views (last 30 days)
Show older comments
I've been trying to solve the linear 2nd order system below, but Matlab keeps saying there isn't a solution. Clearly, there's a solution because the solution will be the intersection of two sine and cosine waves of the same amplitude and phase shift. Because of this, I'm assuming the error is coming from syntax instead of from the math. Can someone take a look at it? Thanks in advanced.
This is the systems of equations I'm trying to solve:
x'' = G*M*sin(theta + 2*pi*t)/(x^2 + y^2)
y'' = G*M*cos(theta + 2*pi*t)/(x^2 + y^2)
Here's the code:
% variables
G = 6.674 * (10.^(-11));
M = 1.9886 * (10.^30);
t = 0:.005:.7;
xi = .44503 * 149.598 * 10.^9; % Initial x dist (AU --> m)
yi = .88106 * 149.598 * 10.^9; % Initial y dist (AU --> m)
thetai = atan((yi/xi)); % Initial angle from x-axis
% Calculations
syms x(t) y(t)
odex = diff(x) == diff(((G*M)./(x.^2 + y.^2)) .* cos(thetai + (2*pi).*t));
odey = diff(y) == diff(((G*M)./(x.^2 + y.^2)) .* sin(thetai + (2*pi).*t));
odes = [odex; odey]
S = dsolve(odes) % Returns not solvable here
1 Comment
John D'Errico
on 29 Apr 2017
You misunderstand what MATLAB is telling you. That dsolve says there is no solution merely means there is no analytical solution. There may well be a solution. But an analytical solution, in terms of radicals, etc., no. There are many problems for which this is true, and they are easy to find.
So just use a numerical ODE solver, like ode45.
Answers (1)
Karan Gill
on 29 Apr 2017
Since you're starting with floating point numbers, you should try a numerical simulation using ode45 or other numeric ODE solver. If you start numeric, stay numeric. Further, since a closed form symbolic solution couldn't be found, numeric is your remaining option.
Also, you declared "t" as a vector of numbers. But when "x(t)" and "y(t)" are defined then "t" gets overwritten by the symbolic variable "t".
0 Comments
See Also
Categories
Find more on Ordinary Differential Equations 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!