solving non-linear ODEs algebraically with symbolic math toolbox

1 visualizzazione (ultimi 30 giorni)
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 Commento
RahulTandon
RahulTandon il 8 Lug 2015
I tried to solve your problem.Explicit Solution not found. But your errors have been removed! The problem has been rephrased!

Accedi per commentare.

Risposte (1)

RahulTandon
RahulTandon il 8 Lug 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')

Categorie

Scopri di più su Symbolic Math Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by