gpt4 book ai didi

r - 在 R 中绘制正弦曲线

转载 作者:行者123 更新时间:2023-12-01 09:49:43 25 4
gpt4 key购买 nike

如何在 R 中绘制通用正弦曲线?
基于 this post 的回答, 我试过:

x <- seq(0,pi,length.out=100)
y <- sin(x)
plot(x,y,type="l")

enter image description here

实际上我真正想要的是这张图,由 gnuplot 制作:
plot sin(x) linestyle 1

enter image description here

另外,我想知道为什么 gnuplot即使我没有为变量 x 分配任何值也会产生一个图形.它是否有预先分配的值或其他什么?

最佳答案

pi只是正弦曲线的一半...添加更多 pi所以你会得到更多的曲线...

x <- seq(0,8*pi,length.out=100)
y <- sin(x)
plot(x,y,type="l")

关于r - 在 R 中绘制正弦曲线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40531262/

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