首页 > 其他分享 >NFC TYPE F PICC接收基带信号及频谱分析

NFC TYPE F PICC接收基带信号及频谱分析

时间:2024-05-26 14:02:38浏览次数:18  
标签:cef plt NFC pattern frame fft np TYPE PICC

import numpy as np
import matplotlib.pyplot as plt
import scipy.signal as signal
import random
fs=13560000
bit_0=[-1]*64+[1]*64
bit_1=[1]*64+[-1]*64
CEF_SOF=bit_0*48
CEF_EOF=[1]*512

cef_frame_length=16
cef_frame_bit=[]
cef_frame_pattern=[]
for i in range(cef_frame_length):
    cef_frame_bit.append(random.choice([0,1]))
cef_frame_bit=[1,0,1,1,0,0,1,0,0,1,0,0,1,1,0,1]+cef_frame_bit #add B24D
cef_frame_pattern=cef_frame_pattern+CEF_SOF
cnt=0
for i in range(cef_frame_length):
    if cef_frame_bit[i]==0:
        cef_frame_pattern=cef_frame_pattern+bit_0
    else:
        cef_frame_pattern=cef_frame_pattern+bit_1
cef_frame_pattern=cef_frame_pattern+CEF_EOF


#212k analysis
cef_frame_pattern_dwon_sample=[]
for i in range(len(cef_frame_pattern)):
    if i%2==0:
        cef_frame_pattern_dwon_sample.append(cef_frame_pattern[i])
# FFT analysis
fft_result=np.fft.fft(np.array(cef_frame_pattern_dwon_sample))
freqs=np.fft.fftfreq(len(fft_result),1/fs)
length_fft=len(fft_result)//2
# find 95% energy frequency distribution
energy_threshold = 0.95 * np.sum(np.abs(fft_result[1:length_fft])**2)
cumulative_energy = 0
freq_range = []
for i in range(len(fft_result)//2):
    if i==0:
        continue
    if cumulative_energy < energy_threshold:
        freq_range.append(freqs[i])
        cumulative_energy += np.abs(fft_result[i])**2
plt.figure(figsize=(12,6))
plt.subplot(2,1,1)
plt.plot(cef_frame_pattern_dwon_sample,marker='.')
plt.title("CEF 212k signal")
plt.subplot(2,1,2)
plt.plot(freqs[:length_fft],np.abs(fft_result)[:length_fft])
plt.axvline(freq_range[0], color='r', linestyle='--', label='95% Energy Range')
plt.axvline(freq_range[-1], color='r', linestyle='--')
plt.title("Fequency Spectrum")
plt.xlabel("Fequency(Hz))")
plt.tight_layout()

#424k analysis
cef_frame_pattern_dwon_sample=[]
for i in range(len(cef_frame_pattern)):
    if i%4==0:
        cef_frame_pattern_dwon_sample.append(cef_frame_pattern[i])
# FFT analysis
fft_result=np.fft.fft(np.array(cef_frame_pattern_dwon_sample))
freqs=np.fft.fftfreq(len(fft_result),1/fs)
length_fft=len(fft_result)//2
# find 95% energy frequency distribution
energy_threshold = 0.95 * np.sum(np.abs(fft_result[1:length_fft])**2)
cumulative_energy = 0
freq_range = []
for i in range(len(fft_result)//2):
    if i==0:
        continue
    if cumulative_energy < energy_threshold:
        freq_range.append(freqs[i])
        cumulative_energy += np.abs(fft_result[i])**2
plt.figure(figsize=(12,6))
plt.subplot(2,1,1)
plt.plot(cef_frame_pattern_dwon_sample,marker='.')
plt.title("CEF 424k signal")
plt.subplot(2,1,2)
plt.plot(freqs[:length_fft],np.abs(fft_result)[:length_fft])
plt.axvline(freq_range[0], color='r', linestyle='--', label='95% Energy Range')
plt.axvline(freq_range[-1], color='r', linestyle='--')
plt.title("Fequency Spectrum")
plt.xlabel("Fequency(Hz))")
plt.tight_layout()


plt.show()

标签:cef,plt,NFC,pattern,frame,fft,np,TYPE,PICC
From: https://blog.csdn.net/u013912838/article/details/139210322

相关文章

  • Haskell 的 自定义类型(data、type)
    在Haskell中,type和data关键字都用于定义新的数据类型,但它们有着不同的作用和语法。一、type关键字:作用:type关键字用于为已有类型创建别名,使得代码更易读和更具可读性。语法:其语法为typeNewType=ExistingType,其中NewType是新类型的名称,ExistingType是已有类......
  • 「TypeScript系列」TypeScript 类/类继承
    文章目录一、TypeScript类二、TypeScript类继承三、TypeScript类-关键字四、TypeScript类-运算符五、TypeScript类-重写(Override)六、TypeScript类-访问控制修饰符1.public2.private3.protected七、TypeScript类和接口1.类(Classes)2.接口(Interfaces)八......
  • TypeScript 学习笔记(十一):TypeScript 与微服务架构的结合应用
    TypeScript学习笔记(十一):TypeScript与微服务架构的结合应用1.引言在前几篇学习笔记中,我们探讨了TypeScript的基础知识、前后端框架的结合应用、测试与调试技巧、数据库以及GraphQL的结合应用。本篇将重点介绍TypeScript与微服务架构的结合应用,包括如何使用TypeSc......
  • TypeScript 学习笔记(十二):TypeScript 与 DevOps 的结合应用
    TypeScript学习笔记(十二):TypeScript与DevOps的结合应用1.引言在前几篇学习笔记中,我们探讨了TypeScript的基础知识、前后端框架的结合应用、测试与调试技巧、数据库、GraphQL以及微服务架构的结合应用。本篇将重点介绍TypeScript与DevOps的结合应用,包括如何在D......
  • Tensors of the same index must be on the same device and the same dtype except `
    避免使用 torch.set_default_dtype(torch.float64) 可以尝试采用model.Double或者model.to(torch.Double)m=torch().to(device).to(torch.float64)     参考:Tensorsofthesameindexmustbeonthesamedeviceandthesamedtypeexcept`step`t......
  • Content-Type 'application/json;charset=UTF-8' is not supported异常解决
    Content-Type'application/json;charset=UTF-8'isnotsupported异常解决前提:确定不是因为Content-Type导致的异常,controller层有注解@RequestBody。报错详情:确定不是因为缺少Jackson依赖或者版本过低:注意到报错信息上边有一条警告日志:.c.j.MappingJackson2HttpMessageCo......
  • MathType免费安装公众号mathtype30天到期后怎么激活
     MathType2024:数学公式编辑的革新者随着科研和教育的不断进步,对数学公式编辑软件的需求日益增加。在这个数字化时代,一款功能强大、操作简便的专业数学公式编辑器显得尤为重要。今天,我们要介绍的就是备受瞩目的新型工具——MathType2024,这是一款旨在满足科研人员、教师和学生......
  • MathType7.5.9中文安装包破解激活图文详细教程
     MathType2024是一款最新发布的专业数学公式编辑软件,它以其卓越的功能和强大的性能在业界引起了广泛关注。这款软件不仅能够帮助用户轻松地创建和编辑复杂的数学公式,还能够与各种流行的文档处理软件无缝集成,极大地提高了用户的工作效率和准确性。让我们来看一下MathType2024......
  • mathtype7最新产品密钥2024免费激活码
     MathType2024,作为最新的专业数学公式编辑神器,以其强大的功能和用户友好的界面,正在重新定义我们编写和分享复杂数学公式的方式。我们需要了解什么是MathType。MathType是一款专业的数学公式编辑软件,它可以帮助教师、学生和科研人员快速创建复杂的数学公式,并可以轻松插入到各......
  • TypeScript中的嵌套泛型
    当我们讨论嵌套泛型时,让我们以一个简单的示例来说明。假设我们有一个泛型类型`Container`,它接受两个类型参数:`T`和`U`。其中`T`表示容器中的数据类型,而`U`则表示某种附加信息的类型。```typescript//定义一个泛型类型ContainertypeContainer<T,U>={data:T;info......