R/optseq.R

#' @description Generate an optimal difference sequence with order r(<=10).
#' @param r The order of the generated difference sequence.
#' @return The generated optimal difference sequence.
#' @examples
#' r<-2
#' optseq(r)
#' @export
optseq=function(r)
{
  if (r==1)
  {d=c(0.7071068,-0.7071068)}
  if (r==2)
  {d=c(0.809017,-0.500000,-0.309017)}
  if (r==3)
  {d=c(-0.19419884,-0.28089005,-0.38315390,0.85824279)}
  if (r==4)
  {d=c(0.46165638,0.48582555,-0.69089320,0.01417428,-0.27076301)}
  if (r==5)
  {d=c(0.1103240,0.1419599,0.1774220,0.2167513,0.2599793,-0.9064365)}
  if (r==6)
  {d=c(0.92002749,-0.22382703,-0.19251983,-0.16355534,-0.13692818,-0.11261641,-0.09058069)}
  if (r==7)
  {d=c(-0.07679141,-0.09301098,-0.11069859,-0.12987754,-0.15056059,-0.17275858,-0.19647145,0.93016914)}
  if (r==8)
  {d=c(-0.2292267,0.2075049,-0.4959129,0.2218229,-0.2005533,-0.4488030,0.1530378,0.5194757,0.2726547)}
  if (r==9)
  {d=c(0.26614340,-0.30203364,0.51895217,-0.12063424,-0.02912806,0.41179438,0.21672768,-0.30741949,-0.44564428,-0.20875794)}
  if (r==10)
  {d=c(0.33687220,0.36048773,0.24937720,-0.10989363,-0.65381286,0.39038008,-0.23432920,-0.15137892,-0.04968255,0.01040466,-0.14842471)}
  return(d)
}

Try the VarED package in your browser

Any scripts or data that you put into this service are public.

VarED documentation built on May 2, 2019, 7:31 a.m.