gpt4 book ai didi

在 Julia 中绘制一组具有多个参数的参数方程

转载 作者:行者123 更新时间:2023-12-05 05:10:11 25 4
gpt4 key购买 nike

要绘制以 (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 中。

enter image description here

最佳答案

这适用于 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))

关于在 Julia 中绘制一组具有多个参数的参数方程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56919909/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com