當前位置: 首頁>>代碼示例>>Golang>>正文


Golang SComplex128Obj.Ts方法代碼示例

本文整理匯總了Golang中github.com/wiless/gocomm.SComplex128Obj.Ts方法的典型用法代碼示例。如果您正苦於以下問題:Golang SComplex128Obj.Ts方法的具體用法?Golang SComplex128Obj.Ts怎麽用?Golang SComplex128Obj.Ts使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/wiless/gocomm.SComplex128Obj的用法示例。


在下文中一共展示了SComplex128Obj.Ts方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: main

func main() {
	var channel core.MPChannel
	channel.InitializeChip()
	N := 100

	param := core.NewIIDChannel()
	param.Ts = 4
	pdp := vlib.VectorF{1, .1}
	param.SetPDP(pdp)
	param.Mode = ""
	channel.InitParam(param)
	// samples := vlib.VectorC(sources.RandNCVec(N, 1))
	samples := vlib.NewOnesC(N)

	var data gocomm.SComplex128Obj
	data.Ts = 2
	for i := 0; i < N; i++ {
		data.Ch = samples[i]
		// fmt.Printf("\n Input %d = %v", i, data)
		chout := channel.ChannelFn(data)
		fmt.Printf("\n  %d I/O : %v ==> %v", i, data.Ch, chout.Ch)
		data.UpdateTimeStamp()
	}

}
開發者ID:postfix,項目名稱:gocomm,代碼行數:25,代碼來源:testchannel.go

示例2: 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

示例3: 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.Ts方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。