# How to Plot 3D Catenoid from Catenary with parametric equations

**URL:** <https://discourse.julialang.org/t/how-to-plot-3d-catenoid-from-catenary-with-parametric-equations/100727>\
**Category:** General Usage\
**Tags:** plotting\
**Created:** [June 23, 2023, 6:17am UTC](https://discourse.julialang.org/t/how-to-plot-3d-catenoid-from-catenary-with-parametric-equations/100727 "2023-06-23T06:17:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [June 23, 2023, 6:17am UTC](https://discourse.julialang.org/t/how-to-plot-3d-catenoid-from-catenary-with-parametric-equations/100727/1 "2023-06-23T06:17:01Z")

</div>

Hi all, I can use some help here. I want to plot a Catenoid, and find this parametric equations:

> **[Catenoid](https://en.wikipedia.org/wiki/Catenoid)**
>
> In geometry, a catenoid is a type of surface, arising by rotating a catenary curve about an axis (a surface of revolution). It is a minimal surface, meaning that it occupies the least area when bounded by a closed space. It was formally described in 1744 by the mathematician Leonhard Euler.
> Soap film attached to twin circular rings will take the shape of a catenoid. Because they are members of the same associate family of surfaces, a catenoid can be bent into a portion of a helicoid, and vice ve...

but the code can’t plot the Catenoid.  
Must be something wrong with how I interpret the parametric equations

```julia
using Plots; 
#plotlyjs()

function catenoid(c)   
    v = 2
    n = 100
    u = range(-π, π; length = n)
    x = c*cosh.(v/c) * cos.(u)'
    y = c*sinh.(v/c) * sin.(u)'
    z = v
    return x, y, z
end

my_cg = cgrad([:red,:blue])
surface(catenoid(2), c=my_cg)

```

---

<div class="post-metadata">

**Author:** ![JM\_Beckers](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jm_beckers/32/22482_2.png) [@JM\_Beckers](https://discourse.julialang.org/u/JM_Beckers)\
**Post date:** [June 23, 2023, 6:34am UTC](https://discourse.julialang.org/t/how-to-plot-3d-catenoid-from-catenary-with-parametric-equations/100727/2 "2023-06-23T06:34:55Z")

</div>

Its a surface so you need two changing variables, here u and v, but in you code you only vary u. You should also vary v say between -2 and 2

---

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [June 23, 2023, 7:02am UTC](https://discourse.julialang.org/t/how-to-plot-3d-catenoid-from-catenary-with-parametric-equations/100727/3 "2023-06-23T07:02:14Z")

</div>

Yes I just try with `v = range(-2, 2; length = n)` still not working:

**Arrays have incorrect length or dimension.**

---

<div class="post-metadata">

**Author:** ![JM\_Beckers](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jm_beckers/32/22482_2.png) [@JM\_Beckers](https://discourse.julialang.org/u/JM_Beckers)\
**Post date:** [June 23, 2023, 7:14am UTC](https://discourse.julialang.org/t/how-to-plot-3d-catenoid-from-catenary-with-parametric-equations/100727/4 "2023-06-23T07:14:18Z")

</div>

I guess it is because z=v is only a 1D array instead of a 2D grid as x and y.

```julia

using Plots; 
#plotlyjs()

function catenoid(c)   
    n = 100
    v = range(-2,2;length= n)
    u = range(-π, π; length = n)
    x = c*cosh.(v/c) * cos.(u)'
    y = c*sinh.(v/c) * sin.(u)'
    z = v* ones(size(u))'
    return x, y, z
end

my_cg = cgrad([:red,:blue])
surface(catenoid(2), c=my_cg)

```

---

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [June 23, 2023, 7:19am UTC](https://discourse.julialang.org/t/how-to-plot-3d-catenoid-from-catenary-with-parametric-equations/100727/5 "2023-06-23T07:19:31Z")

</div>

> [@JM\_Beckers](#):
>
> ` z = v* ones(size(u))'`

That solved my problem. Great! and Thanks.
