solving non-linear ODEs algebraically with symbolic math toolbox
1 view (last 30 days)
Show older comments
Hi! I'm trying to solve a second order nonlinear ODE for $u_n(t)$, and I have this code:
clear all
n = sym('n');
p = sym('p'); %constant
syms y(x)
d2y = diff(y,2);
dy = diff(y);
dsolve(d2y - (dy)^2/(2*y) - (3*y^3)/2 - 4*x*y^2 - 2*(x^2 + n/2 + (2*p + 1)*(1 + 3*(-1)^n)/4)*y +(n + (2*p + 1)*(1 - (-1)^n))/(4*y) == 0)
I'm getting errors:
Error using assignin Invalid variable name "y(x)" in ASSIGNIN.
Error in syms (line 47) assignin('caller',varargin{1},sym(varargin{1}));
Error in diff_eqn_recc (line 6) syms y(x)
I don't know what's causing this, can anyone help?
Thanks!
1 Comment
RahulTandon
on 8 Jul 2015
I tried to solve your problem.Explicit Solution not found. But your errors have been removed! The problem has been rephrased!
Answers (1)
RahulTandon
on 8 Jul 2015
%% Rephrased your problem clc; syms n p x y(x); y = dsolve('D2y - (Dy)^2/(2*y) - (3*y^3)/2 - 4*x*y^2 - 2*(x^2 + n/2 + (2*p + 1)*(1 + 3*(-1)^n)/4)*y +(n + (2*p + 1)*(1 - (-1)^n))/(4*y) == 0','x')
0 Comments
See Also
Categories
Find more on Symbolic Math Toolbox 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!