Skip to main content

parametricNDSolve for solving differential equation


i want to solve this equation and plot it solution w.r.t N2 and theta(0)


theta''[x] + 2*theta'[x] - Exp[-2*x]*(N2)^2*(theta[x] - 5) + Q1 == 0 anyone please help



Answer



It is not clear what you want plotted nor how you want the plots done. Neither have you specified the range of the variables that are of interest. The following will need to be tailored once you understand your needs.



Clear["Global`*"]

{xmin, xmax} = {0, 1};

Manipulate[
Module[{eqns1, sol1},
eqns1 =
{theta''[x] + 2*theta'[x] - Exp[-2*x]*N21^2*(theta[x] - 5) + Q11 == 0,
theta[0] == t01, theta'[0] == tp01};
sol1 = ParametricNDSolve[eqns1, theta, {x, xmin, xmax}, N21];

Plot3D[Evaluate[theta[N21][x] /. sol1],
{x, xmin, xmax}, {N21, 0, 5},
AxesLabel -> (Style[#, 14, Bold] & /@ {"x", "N2", "theta"}),
ClippingStyle -> None]],
{{Q11, 5, Q1}, 0, 10, Appearance -> "Labeled"},
{{t01, 0, "theta[0]"}, 0, 10, Appearance -> "Labeled"},
{{tp01, 0, "theta'[0]"}, 0, 10, Appearance -> "Labeled"}]
(* spacer *)

enter image description here



Manipulate[
Module[{eqns2, sol2},
eqns2 =
{theta''[x] + 2*theta'[x] - Exp[-2*x]*N22^2*(theta[x] - 5) + Q12 == 0,
theta[0] == t02, theta'[0] == tp02};
sol2 = ParametricNDSolve[eqns2, theta, {x, xmin, xmax}, t02];
Plot3D[Evaluate[theta[t02][x] /. sol2],
{x, xmin, xmax}, {t02, 0, 5},
AxesLabel -> (Style[#, 14, Bold] & /@ {"x", "theta[0]", "theta"}),
ClippingStyle -> None]],

{{Q12, 5, Q1}, 0, 10, Appearance -> "Labeled"},
{{N22, 5, N2}, 0, 10, Appearance -> "Labeled"},
{{tp02, 0, "theta'[0]"}, 0, 10, Appearance -> "Labeled"}]
(* spacer *)

enter image description here


Comments