简体   繁体   中英

drawing a sine function in a r plot

I would like to draw a simple sin and such a function

在此处输入图片说明

in a R plot.

I am using this code:

plot(sin, 0,  2*pi)
curve((4sin+(1/3)sin(3x))/pi, xlim = c(0, 2*pi), n = 1001, col = "blue", add = TRUE)

but I get this error:

Error: unexpected symbol in "curve((4sin"

What should I do to solve this problem?

You don't like the * symbol?

plot(sin, 0,  2*pi)
curve(4*(sin(x)+(1/3)*sin(3*x))/pi, xlim = c(0, 2*pi), n = 1001, col = "blue", add = TRUE)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM