Filter löschen
Filter löschen

solving non-linear ODEs algebraically with symbolic math toolbox

2 Ansichten (letzte 30 Tage)
María Jesús
María Jesús am 8 Jul. 2015
Beantwortet: RahulTandon am 8 Jul. 2015
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 Kommentar
RahulTandon
RahulTandon am 8 Jul. 2015
I tried to solve your problem.Explicit Solution not found. But your errors have been removed! The problem has been rephrased!

Melden Sie sich an, um zu kommentieren.

Antworten (1)

RahulTandon
RahulTandon am 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')

Community Treasure Hunt

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

Start Hunting!

Translated by