乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      用R語言畫蝴蝶曲線

       新用戶5228KeDY 2021-10-10

      用R語言畫蝴蝶曲線

      蝴蝶曲線的極坐標方程為

      參數(shù)取值范圍為。

      寫成參數(shù)方程,為

      參數(shù)取值范圍與極坐標下是相同的。一般為了追求曲線多一些變化,往往把改寫成

      這些天不少文章用matlab、mathematica、maple、python語言,甚至scratch、VBA等繪制它,卻唯獨少了R語言。然而R語言在可視化的表現(xiàn)力方面是相當相當強大的。下面用R來畫蝴蝶曲線。

      在參數(shù)方程下用ggplot2包繪制

      t<-seq(from = 0, to = 12*pi, by = 0.005)
      x<-sin(t)*(exp(cos(t)) - 2*cos(4*t)-(sin(t/11))^5)
      y<-cos(t)*(exp(cos(t)) - 2*cos(4*t)-(sin(t/11))^5)
      mydata<-data.frame(x = x, y = y)
      library(ggplot2)
      ggplot(data = mydata,aes(x = x, y = y))+
        geom_point(colour = 'blue')+
        coord_cartesian()

      在參數(shù)方程下直接使用plot低水平函數(shù)繪制

      t<-seq(from = 0, to = 12*pi, by = 0.005)
      x<-sin(t)*(exp(cos(t)) - 2*cos(4*t)-(sin(t/11))^5)
      y<-cos(t)*(exp(cos(t)) - 2*cos(4*t)-(sin(t/11))^5)
      mydata<-data.frame(x = x, y = y)
      par(mfrow=c(2,1))
      plot(x,y,"s",col="blue")
      plot(x,y,"h",col="cyan2")

      極坐標方程下用IDPmisc極坐標轉直角坐標

      t<-seq(from = 0, to = 12*pi, by = 0.005)
      r <-exp(cos(t))-2*cos(4*t)+(sin(t/12))^5
      library(IDPmisc)
      #小心IDPmisc極坐標轉直角坐標的phi用度作為角單位
      xy <- clock2cart(rho=r,phi=t/pi*180,circle=-360)

      library(ggplot2)
      ggplot(data = xy,aes(x = x, y = y))+
        geom_point(colour = 'red')

      把直角坐標彎曲對應到平面圓里面

      t<-seq(from = 0, to = 12*pi, by = 0.005)
      r <-exp(cos(t))-2*cos(4*t)+(sin(t/12))^5
      library(IDPmisc)
      #小心IDPmisc極坐標轉直角坐標的phi用度作為角單位
      xy <- clock2cart(rho=r,phi=t/pi*180,circle=-360)

      library(ggplot2)
      ggplot(data = xy,aes(x = x, y = y))+
        geom_point(colour = 'red')+
        coord_polar()  

        轉藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多