2
$\begingroup$

This is the code that I was able to make

h[x_]:= x^2; a = 1; b = 5; n = 5; dx = b-a/n; 

Those are my parameters

Table[ParametricPlot3D[{(a + i*dx) Cos[t], (a + i*dx) Sin[t], h},
 {t, 0, 2Pi}, {h, 0, h[a + i*dx]}], {i, 1, n}]

But I can't manage to plot them on the same graphic, I am trying to use the DiscretePlot3D function but I need more input for my code, I don't know what I am doing wrong.

DiscretePlot[[Table[ParametricPlot3D[{(a + i*dx) Cos[t],(a + i*dx) Sin[t], h},
 {t, 0, 2 Pi}, {h, 0, h[a + i*dx]}], {i, 1, n}]], {Table, 1, n}]

Some help would be really appreciated.

$\endgroup$

closed as off-topic by Pillsy, ybeltukov, MarcoB, user9660, m_goldberg Nov 9 '15 at 17:04

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Pillsy, ybeltukov, MarcoB, Community, m_goldberg
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Your code has a syntax error, with the second bracket after DiscretePlot. $\endgroup$ – Pillsy Nov 9 '15 at 15:11
  • $\begingroup$ How about using GraphicsGrid[Table[...]]? $\endgroup$ – egwene sedai Nov 9 '15 at 15:12
  • $\begingroup$ Rasterize[ GraphicsRow[ Table[ParametricPlot3D[{(a + i*dx) Cos[t], (a + i*dx) Sin[t], h}, {t, 0, 2 Pi}, {h, 0, h[a + i*dx]}], {i, 1, n}]], ImageSize -> 800, ImageResolution -> 1200] $\endgroup$ – egwene sedai Nov 9 '15 at 15:15
5
$\begingroup$
f[a_, b_, n_, s_] := # {Cos@t, Sin@t, s #} &@(a + #*(b - a/n)) & /@  Range@n

p[a_, b_, n_] := ParametricPlot3D[f[a, b, n, s], {t, 0, 2 Pi}, {s, 0, 1},
                         PlotRange -> b n {{-1, 1}, {-1, 1}, {0, b n}}, 
                         PlotStyle -> ({Opacity[# /10 ], Hue[#]} & /@ (n/Range@n)), 
                         Mesh -> None, Evaluated -> True, BoxRatios -> {1, 1, 1}]

p[1,5,5]

Mathematica graphics

p[1,5,10]

Mathematica graphics

$\endgroup$
2
$\begingroup$

Not quite sure what you mean by "on the same graphic", so here's a few guesses.

cylinderlist = 
 Table[ParametricPlot3D[{(a + i*dx) Cos[t], (a + i*dx) Sin[t], h}, {t,
     0, 2 Pi}, {h, 0, h[a + i*dx]}, PlotPoints -> 100], {i, n}]

Show them all in a row,

Grid[{cylinderlist}]

enter image description here

Or perhaps laid over each other, on the same coordinate system

Show[Reverse@cylinderlist]

But there you can only see the outer one, but you can restrict the PlotRange to show them all

Show[Reverse@cylinderlist, PlotRange -> {Automatic, Automatic, {0, 30}}]

enter image description here

$\endgroup$
1
$\begingroup$
Show@
 Table[
   ParametricPlot3D[
    {(a + i*dx) Cos[t], (a + i*dx) Sin[t], h}, {t, 0, 2 Pi}, {h, 0, h[a + i*dx]},
    BoxRatios -> {1, 1, 1}, 
    PlotRange -> {{-30, 30}, {-30, 30}, {0, 600}},
    PlotStyle -> Opacity[0.5], Mesh -> None
   ],
   {i, 1, n}
 ]

Mathematica graphics

$\endgroup$
0
$\begingroup$
GraphicsRow[Table[ParametricPlot3D[{(a + i*dx) Cos[t], (a + i*dx) Sin[t], h}, 

{t, 0, 2 Pi}, {h, 0, h[a + i*dx]}], {i, 1, n}]]

or, use GraphicsGrid[] for more complex layouts (reference).

enter image description here

$\endgroup$
0
$\begingroup$

Is it this, that you need?

 h[x_] := x^2; a = 1; b = 5; n = 5; dx = b - a/n;
Show@Table[
  ParametricPlot3D[{(a + i*dx) Cos[t], (a + i*dx) Sin[t], h}, {t, 0, 
    2 Pi}, {h, 0, h[a + i*dx]}, PlotStyle -> Opacity[0.3], 
   PlotRange -> {{-30, 30}, {-30, 30}, {0, 650}}, 
   ColorFunction -> "LakeColors"], {i, 1, n}]

giving enter image description here

May be, it will be better visible like this:

 Show@Table[
  ParametricPlot3D[{(a + i*dx) Cos[t], (a + i*dx) Sin[t], h}, {t, 0, 
    2 Pi}, {h, 0, h[a + i*dx]}, PlotStyle -> Opacity[0.5], 
   PlotRange -> {{0, 30}, {-30, 0}, {0, 650}}, 
   ColorFunction -> "LakeColors", ViewPoint -> {-30, 5, 60}], {i, 1, 
   n}]

you should see this:

enter image description here

Have fun!

$\endgroup$

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