2

要绘制以 (1, 1) 为中心的半径为 2 的圆,我执行以下操作:

θ = 0:0.1:2π
x = 1 .+ 2cos.(θ)
y = 1 .+ 2sin.(θ)
plot(x, y, aspect_ratio=:equal)

但是,如果我想绘制一组具有两个以上参数的参数方程,我不能使用这种方法。一种方法应该如何在 Julia 中绘制具有多个参数的参数方程?例如,我如何绘制由参数方程描述的圆锥

x = r*cos(θ)
y = r*sin(θ)
z = r

参数在哪里rθ

我正在想象最终的情节如下图所示,该图是通过输入ParametricPlot3D[{r*Cos[t], r*Sin[t], r}, {r, -3, 3}, {t, 0, 2*Pi}]Mathematica 生成的。

在此处输入图像描述

4

1 回答 1

2

这适用于plotlypyplot后端,Plots但不适用于gr

X(r,theta) = r * cos(theta)
Y(r,theta) = r * sin(theta)
Z(r,theta) = r

rs = range(0, 2, length=50)
ts = range(0, 2pi, length=50)

surface(X.(rs',ts), Y.(rs', ts), Z.(rs', ts))
于 2019-07-07T20:53:48.010 回答