要绘制以 (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 中。
最佳答案
这适用于 plotly
和 pyplot
后端到 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))
关于在 Julia 中绘制一组具有多个参数的参数方程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56919909/