如何使用python3.7 matplotlib_使用matplotlib的python 3.7中的黑噪声

本文介绍了香农的信息熵概念,它定义了消息中的信息量,并将其与热力学熵相联系。香农还分析了通信信道的传输能力,即带宽,并展示了即使在噪声信道中,通过保持传输速率在信道带宽内并使用错误纠正编码,可以实现近乎完美的无错通信。如今,从调制解调器到音乐CD,都依赖于这种错误纠正技术来正常工作。
摘要由CSDN通过智能技术生成

importmatplotlib.pylabasplt

LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'deffrequency_analysis(plain_text):#the text we analyiseplain_text=plain_text.upper()#we use a dictionary to store the letter-frequency pairletter_frequency={}#initialize the dictionary (of course with 0 frequencies)forletterinLETTERS:letter_frequency[letter]=0#let's consider the text we want to analyseforletterinplain_text:#we keep incrementing the occurence of the given letterifletterinLETTERS:letter_frequency[letter]+=1returnletter_frequencydefplot_distribution(letter_frequency):centers=range(len(LETTERS))plt.xlabel("Letters")plt.ylabel("Numbers")plt.bar(centers,letter_frequency.values(),align='center',tick_label=letter_frequency.keys())plt.xlim([0,len(LETTERS)-1])plt.show()if__name__=="__main__":plain_text="Shannon defined the quantity of information produced by a source for example, the quantity in a message by a formula similar to the equation that defines thermodynamic entropy in physics. In its most basic terms, Shannon's informational entropy is the number of binary digits required to encode a message. Today that sounds like a simple, even obvious way to define how much information is in a message. In 1948, at the very dawn of the information age, this digitizing of information of any sort was a revolutionary step. His paper may have been the first to use the word bit, short for binary digit. As well as defining information, Shannon analyzed the ability to send information through a communications channel. He found that a channel had a certain maximum transmission rate that could not be exceeded. Today we call that the bandwidth of the channel. Shannon demonstrated mathematically that even in a noisy channel with a low bandwidth, essentially perfect, error-free communication could be achieved by keeping the transmission rate within the channel's bandwidth and by using error-correcting schemes: the transmission of additional bits that would enable the data to be extracted from the noise-ridden signal. Today everything from modems to music CDs rely on error-correction to function. A major accomplishment of quantum-information scientists has been the development of techniques to correct errors introduced in quantum information and to determine just how much can be done with a noisy quantum communications channel or with entangled quantum bits (qubits) whose entanglement has been partially degraded by noise."frequencies=frequency_analysis(plain_text)plot_distribution(frequencies)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值