# 3D Plot using ParametricNDSolve

I want to make a 3D plot using the following code. Please help.

a = 0.5;
d = 1.0;
Ha = 3.0;
x = 0.5;
q = 1.0;
alp = 0.1;
bt = 2.0;
m = 5.0;
F = q*Exp[-alp*c];
h = (1 - a*Cos[3.14*(x - c)]*Cos[3.14*(x - c)]);
sols = ParametricNDSolve[{y''''[t] ==
Ha^2 y''[t] - (m*m*m*bt*Sinh[m*t]/Cosh[m*h]), y''[0] == 0,
y[0] == 0, y'[h] == 0, y[h] == F}, y, {t, 0, h}, {c}]
Plot3D[Evaluate[y'[t] /. sols], {t, 0, h}, {c, 0, 2},
PlotRange -> All]


a = 0.5;
d = 1.0;
Ha = 3.0;
x = 0.5;
q = 1.0;
alp = 0.1;
bt = 2.0;
m = 5.0;
F = q*Exp[-alp*c];
h = (1 - a*Cos[3.14*(x - c)]*Cos[3.14*(x - c)]);


You wrote c is range 0..2 then: h is: Max[(1 - a*Cos[Pi*(x - #)]*Cos[Pi*(x - #)])] & /@ Range[0, 2] is 1,and for that I set up a t=(0..1).

sol[c_] :=
NDSolve[{y''''[t] == Ha^2 y''[t] - (m*m*m*bt*Sinh[m*t]/Cosh[m*h]),
y''[0] == 0, y[0] == 0, y'[h] == 0, y[h] == F}, y, {t, 0, 1}]

Plot[Evaluate[Table[y'[t] /. sol[c], {c, 0, 2, .1}]], {t, 0, 1},
PlotRange -> {Automatic, {-2, 3}}]


Plot[Evaluate[Table[y'[t] /. sol[c], {c, 0, 2, 1/4}]], {t, 0, 1},
PlotRange -> {Automatic, {-2, 3}},
PlotLabels -> {"c=0", "c=1/4", "c=1/2", "c=3/4", "c=1", "c=5/4",
"c=3/2", "c=7/4", "c=2"}, AxesLabel -> {"t", "y'[t]"}]


 ListPlot3D[Partition[Flatten[Table[Evaluate[Table[{c, t, (y'[t] /.sol[c])[[1]]}, {c, 0, 2, 1/20}]], {t, 0,
1, 1/20}]], 3], AxesLabel -> {c, t},PlotRange -> Full]


• Thank you so much for your kind help. But the "PlotLabels" option does not work in my MATHEMATICA 10.0. It becomes Red when I write "PlotLabels". But If I replaced it by "PlotLabel", then the labels appear at the top of the figure in a single row. May I know, how to fix it? – Biswajit Mallick Jul 15 '17 at 6:39
• @BiswajitMallick. Use: Plot[Evaluate[Table[y'[t] /. sol[c], {c, 0, 2, 1/4}]], {t, 0, 1}, PlotRange -> {Automatic, {-2, 3}}, PlotLegends -> {"c=0", "c=1/4", "c=1/2", "c=3/4", "c=1", "c=5/4", "c=3/2", "c=7/4", "c=2"}, AxesLabel -> {"t", "y'[t]"}] works in MMA 10.2. – Mariusz Iwaniuk Jul 16 '17 at 13:40
• Thank you very much @Mariusz Iwaniuk. – Biswajit Mallick Jul 18 '17 at 10:17
• Could you kindly have a look on my last question. I have to make a contour plot. @Mariusz Iwaniuk – Biswajit Mallick Jul 18 '17 at 13:49
• @BiswajitMallick. Do not forget to vote for my correct answers. – Mariusz Iwaniuk Jul 18 '17 at 15:11

DSolve is able to find an analytical solution to your ode,

sol = DSolve[{y''''[t] == Ha^2 y''[t] - (m*m*m*bt*Sinh[m*t]/Cosh[m*h]), y''[0] == 0,
y[0] == 0, y'[h] == 0, y[h] == F}, y, t];

Dy = D[y[t] /. sol, t];

Plot3D[Dy, {t, 0, 1}, {c, 0, 2}]


• Thank you. But I have to use NDSolve only due to the complexity of my original problem. – Biswajit Mallick Jul 15 '17 at 6:40