gpt4 book ai didi

plot - 使用 gnuplot 的迭代参数图

转载 作者:行者123 更新时间:2023-12-01 15:32:02 26 4
gpt4 key购买 nike

我想在 gnuplot 中使用迭代绘图函数 plot for 来绘制参数图。

set parametric
f(x) = x
plot for [i=1:2] t,f(i*t)

但是,据我了解in this Question , for 迭代在逗号后结束。因此迭代仅适用于 t 而不适用于 f(i*t)。但是由于参数图需要一对用逗号分隔的函数,我如何告诉 gnuplot 迭代地绘制我的参数图?

最佳答案

你真的试过了吗? gnuplot 区分参数坐标和 plot-element 结尾之间的逗号,因为它被调用(可以包含 for 循环):这只需计算给定坐标的数量即可完成。

例如,

set parametric
set size ratio -1
plot for [i=1:3] cos(t),i*sin(t) title "Ellipse ".i, \
for [i=1:3] i*cos(t),i*sin(t) title "Circle ".i

如果你这样做

plot for [i=1:3] cos(t),i*sin(t),i*cos(t),i*sin(t)

然后你保留 3 个椭圆(好吧,包括 i=1 时的圆),并为 i=3 绘制一个圆(值 i 保留在for 循环)来自最后一对坐标。

关于plot - 使用 gnuplot 的迭代参数图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37024230/

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