1
$\begingroup$

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]
$\endgroup$
3
$\begingroup$

Read this

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}}]

enter image description here

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]"}]

enter image description here

 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]

enter image description here

$\endgroup$
  • $\begingroup$ 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? $\endgroup$ – Biswajit Mallick Jul 15 '17 at 6:39
  • $\begingroup$ @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. $\endgroup$ – Mariusz Iwaniuk Jul 16 '17 at 13:40
  • $\begingroup$ Thank you very much @Mariusz Iwaniuk. $\endgroup$ – Biswajit Mallick Jul 18 '17 at 10:17
  • $\begingroup$ Could you kindly have a look on my last question. I have to make a contour plot. @Mariusz Iwaniuk $\endgroup$ – Biswajit Mallick Jul 18 '17 at 13:49
  • 1
    $\begingroup$ @BiswajitMallick. Do not forget to vote for my correct answers. $\endgroup$ – Mariusz Iwaniuk Jul 18 '17 at 15:11
2
$\begingroup$

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}]

enter image description here

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.