当前位置: 首页>>代码示例>>Golang>>正文


Golang SComplex128Obj.TimeStamp方法代码示例

本文整理汇总了Golang中github.com/wiless/gocomm.SComplex128Obj.TimeStamp方法的典型用法代码示例。如果您正苦于以下问题:Golang SComplex128Obj.TimeStamp方法的具体用法?Golang SComplex128Obj.TimeStamp怎么用?Golang SComplex128Obj.TimeStamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/wiless/gocomm.SComplex128Obj的用法示例。


在下文中一共展示了SComplex128Obj.TimeStamp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: main

func main() {

	N := 20 /// 20 samples
	L := 4  /// 5tap channel
	begin := time.Now()

	var cdma core.CDMA
	cdma.InitializeChip()
	cdma.SetSpreadCode(vlib.NewOnesC(L), true)

	samples := vlib.VectorC(sources.RandNCVec(N, 1))
	var data gocomm.SComplex128Obj
	/// METHOD A
	data.Ts = 1
	data.TimeStamp = 0
	data.MaxExpected = N
	data.Message = ""
	for i := 0; i < N; i++ {
		data.Next(samples[i])
		chips := cdma.SpreadFn(data)
		output := cdma.DeSpreadFn(chips)
		fmt.Printf("\nTxSymbol %v ", data)
		// fmt.Printf("\nTx %v ", chips)
		fmt.Printf("\nRxSymbol %v ", output)
	}

	/// METHOD B
	// dataArray.MaxExpected = samples.Size()
	// inCHA := gocomm.NewComplex128Channel()
	// outputPin := filter.PinByID(1)

	// go filter.Filter(inCHA)
	// go chipset.Sink(outputPin)
	// /// Actual data pushing
	// for i := 0; i < N; i++ {
	// 	dataArray.MaxExpected = N
	// 	dataArray.Ch = samples[i]
	// 	inCHA <- dataArray
	// }

	//fmt.Printf("\nFilter Residues %v", filter.FilterMemory)

	//  Of code
	fmt.Printf("\nTime Elapsed : %v\n", time.Since(begin))
}
开发者ID:postfix,项目名称:gocomm,代码行数:45,代码来源:cdma.go

示例2: AWGNChannel

func (m *ChannelEmulator) AWGNChannel(dummy gocomm.Complex128Channel) {
	// fmt.Printf("\n Noise ready to Input %v", dummy)
	outCH := m.Pins["symbolOut"].Channel.(gocomm.Complex128Channel)
	// fmt.Printf("\n Output ready to Output %v", outCH)
	var chdataOut gocomm.SComplex128Obj
	var chdataIn gocomm.SComplex128Obj
	samples := 1
	// result := make([]complex64, samples)
	var StdDev float64 = math.Sqrt(m.noise * .5)
	var Mean float64 = m.Mean
	var noise complex128
	// var noisevector vlib.VectorC
	for i := 0; i < samples; i++ {

		chdataIn = <-dummy
		chdataOut.MaxExpected = chdataIn.MaxExpected
		samples = chdataIn.MaxExpected

		// fmt.Printf("\nAWGN expects %d samples @ %v", samples, dummy)
		chdataOut.Message = chdataIn.Message
		chdataOut.Ts = chdataIn.Ts
		chdataOut.TimeStamp = chdataIn.TimeStamp
		if !strings.Contains(chdataIn.Message, "BYPASS") {

			if Mean == 0 && StdDev == 1 {
				noise = complex128(complex(rand.NormFloat64(), rand.NormFloat64()))
			} else {
				noise = complex128(complex(rand.NormFloat64()*StdDev+Mean, rand.NormFloat64()*StdDev+Mean))

			}
			// noisevector = append(noisevector, noise)
			chdataOut.Ch = chdataIn.Ch + noise

		} else {
			chdataOut.Ch = chdataIn.Ch

		}
		//fmt.Printf("\nNoise%f=%f", StdDev, noisevector)
		outCH <- chdataOut
	}

}
开发者ID:postfix,项目名称:gocomm,代码行数:42,代码来源:awgn.go


注:本文中的github.com/wiless/gocomm.SComplex128Obj.TimeStamp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。