How to Plot 3D Catenoid from Catenary with parametric equations

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

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

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)

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

2 Likes

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

Arrays have incorrect length or dimension.

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


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)

2 Likes

That solved my problem. Great! and Thanks.