0

I have an example of MathLAD's code. One of result of this code is a polar plot. enter image description here

I have tried to rewrite the code into R (code is below). My polar plot is: enter image description here

Edit. After the Michael Bird comment I have fixed the code.

enter image description here

Question. Could someone give an idea how to extend polar plot on full circle?

    K<-8
N<-6

x <- seq(-10, 10, 0.01)

f1 <- function(x){
result <- 1/N*sin(pi*x)/sin(pi/N*x)
return(result)
}

f2 <- function(x){
result <- 1-abs(f1(x-N/2))
return(result)
}

par(mfrow=c(1,2))
plot(f2(x), type="l")

phi <- seq(0, 360)
xphi <- phi/2/pi*N*K 

polar.plot(f2(xphi), 
           polar.pos = seq(0,360, length.out=length(phi)), 
           labels="", rp.type = "polygon", main="f2")
Nick
  • 1,086
  • 7
  • 21
  • 1
    According to `?polar.plot` the `polar.pos` variable needs to be a vector spanning [0,360] so why not put `polar.pos = seq(0,360, length.out=length(phi))`? – Michael Bird Oct 04 '17 at 10:40
  • @MichaelBird, thanks I have update the text, you was right. The question is solved. – Nick Oct 05 '17 at 03:15

0 Answers0