AN AUDITORY-BASED TRANSFROM FOR AUDIO SIGNAL PROCESSING

AN AUDITORY-BASED TRANSFROM FOR AUDIO SIGNAL PROCESSING
AN AUDITORY-BASED TRANSFROM FOR AUDIO SIGNAL PROCESSING

AN AUDITORY-BASED TRANSFROM FOR AUDIO SIGNAL PROCESSING

Qi(Peter)Li

Li Creative Technologies,Inc.

Florham Park,New Jersey07932,USA

qili@https://www.360docs.net/doc/a2265633.html,

ABSTRACT

An auditory-based transform is presented in this paper.Through an analysis process,the transform coverts time-domain signals into a set of?lter bank output.The frequency responses and distributions of the?lter bank are similar to those in the basilar membrane of the cochlea.Signal processing can be conducted in the decomposed signal domain.Through a synthesis process,the decomposed sig-nals can be synthesized back to the original signal through a sim-ple computation.Also,fast algorithms for discrete-time signals are presented for both the forward and inverse transforms.The trans-form has been approved in theory and validated in experiments. An example on noise reduction application is presented.The pro-posed transform is robust to background and computational noises and is free from pitch harmonics.The derived fast algorithm can also be used to compute continuous wavelet transform.

Index Terms—Noise reduction,robust audio signal process-ing,fast transform,cochlea

1.INTRODUCTION

The Fourier transform(FT)is the most popularly used transform to convert signals from the time domain to frequency domain; however,it has?xed time-frequency resolution and the frequency distribution is restricted to be linear.These limitations generate problems in audio and speech processing such as the pitch har-monics,computational noise,and sensitivity to background noise. On the other hand,the wavelet transform(WT)provides?exible time-frequency resolution,but also has notable problems.First, no existing wavelet is capable of mimicking the impulse responses of the basilar membrane closely,so it cannot be directly used to model the cochlea or carry out related computation.Additionally, even though forward and inverse continuous wavelets transforms are de?ned for continuous variables,to the best of our knowledge, there is no numerical computational formula for real inverse con-tinuous wavelet transforms(ICWT).No such function exists even in a commercial wavelet package.Discrete wavelet transform has been applied in speech processing,but the frequency distribution is limited to the dyadic scale which is different from the scale in the cochlea.

Motivated by the fact that the human auditory system outper-forms current machine-based systems for acoustic signal process-ing,we developed an auditory-based transform to facilitate our fu-ture research in developing high performance systems.The trav-eling waves of the basilar membrane in the cochlea and its impose response have been measured and reported in the literature,such as This work was supported in part by the AFRL under grant FA8750-08-C-0028.[1].The basilar membrane tuning and auditory?lter shapes have also been studied in the literature,such as[2].Many electronic and mathematic models have been de?ned to mimic the traveling wave, auditory?lters,and frequency responses of the basilar membrane. Furthermore,based on the concept of the cochlea,many feature extraction algorithms have been developed for speech recognition, such as MFCC and others.Since all the above approaches are focused on studying and modeling the auditory periphery system. They provide the analysis,but no synthesis.However,an auditory-based transform with both forward and inverse transforms for dig-ital computers is needed for many audio applications,such as noise reduction,hearing aid,coding,speech and music synthesis, speaker and speech recognition,etc.

Gamatone?lter banks[3]has been proposed to model the im-pulse responses of the basilar membrane and has been used to de-compose time-domain signals into different frequency bands;how-ever,there is no mathematical proof of how to synthesize the de-composed multichannel signals back to a time-domain signal.Al-though some suggestions on resynthesis have been given in plain language[4]or simply at the conceptual level,there remain no details or mathematical proof to validate the accuracy and compu-tation ef?ciency.Actually,from our analysis,the suggested com-putation in[4]is at least redundant.In[5],a Gammatone based transform with analysis and synthesis was presented,but the?lter bank derives a complex valued output which is not only different from the real cochlea but further complicates its implementation.

To employ the concept of the auditory system to audio signal processing,Li proposed an auditory-based transform in[6].The detailed results are presented here.We note that the purpose of this research is not to model the cochlea precisely and completely; instead,it is to provide a simple and fast transform for real appli-cation,as an alternative selection to the FT and WT.

2.DEFINITION OF THE PROPOSED TRANSFORM When sound enters the human ear,acoustic energy from the outer ear is converted to mechanical energy via the middle ear which consists of three small bones.When the last bone in the middle ear,the stapes,moves,it sets the?uid inside the cochlea in mo-tion creating traveling waves on the basilar membrane.the impulse response of the basilar membrane(BM)in the cochlea can be rep-resented by function.The function satis?es the following conditions:

1.It integrates to zero:

(1)

2.It is square integrable or has?nite energy:

(2)

3.It satis?es:

(3)

where and

(4)

4.It tapers off to zero on both ends just as it is observed in

psychoacoustic experiments with the BM[1].

5.It has one major modulation frequency and its frequency

response is a triangle-like,band-pass?lter.

The?rst three conditions are required by mathematics for further derivation.The last two are required in order to match previous psychoacoustic and physiological experimental results and to ap-proximate numerical computations presented later.

Let be any square integrable function.The forward trans-form of with respect to a function representing the BM im-pulse response is de?ned as:

(5) where and are real,and both and belong to, and represents the traveling waves in the BM.The above equation can also be written as:

(6) where

(7)

Note that is an energy normalizing factor.It ensures that the energy stays the same for all and;therefore,we have:

(8)

The factor is a scale or dilation variable.By changing,we can shift the central frequency of an impulse response function.The factor is a time shift or translation variable.For a given value of ,the factor shifts the function by an amount along the time axis.

A typical cochlear impulse response function or cochlear?lter can be de?ned as:

(9)

where and,is the unit step function,

for and otherwise.The value of should be selected such that(1)is satis?ed.is the time shift variable,and is the scale variable.The value of can be determined by the current?lter

Figure1:Impulse responses of the BM in the proposed transform when and.They are very similar to psychological measurements,such as the?gures in[1].

Figure2:The frequency responses of the cochlear?lters when :(A);and(B).

central frequency and the lowest central frequency in the cochlear?lter bank:

(10) Since we contract with the lowest frequency along the time axis,the value of is in.If we stretch,the value of.The frequency distribution of the cochlear?lter can be in the form of linear or nonlinear scales such as ERB(equivalent rectangular bandwidth)Bark,Mel,log,etc.Note that the values of the needs to be pre-calculated for the required central fre-quency of the cochlear?lter.Fig.1shows the impulse responses for5cochlear?lters and Fig.2,their corresponding frequency re-sponses.Normally,we use.The value of can be selected by applications.We used for noise reduction and smaller values for feature extraction.

3.THE INVERSE TRANSFORM

Just as the Fourier transform requires an inverse transform a sim-ilar inverse transform is also needed for the proposed transform.

The need arises when the processed frequency decomposed sig-nals need to be converted back real signals,such as speech and music synthesis and noise reduction;and second,to prove that no information is lost through the proposed forward transforms.This is necessary to a transform.

If(3)is satis?ed,the inverse transform exists:

(11)

The derivation of the above transform is similar to inverse continu-ous wavelet transform[7].Equation(6)can be written in the form of convolution with:

(12) Take the Fourier transform of both sides,the convolution becomes multiplication:

(13) where and represents the Fourier transforms of and,respectively.We now multiply both sides of the above equation by and integrate with:

(14) The integration on the right hand side can be further written as:

(15) to meet the admissibility condition in(3)where is a constant. Rearrange(14),we can then have

(16) We now can take inverse Fourier transform on both sides of the above equation to achieve(11).

4.THE DISCRETE-TIME AND FAST TRANSFORM

In practical applications,the discrete-time cochlear transform is necessary.The forward discrete transform can be written as:

(17) where is the scaling factor for the th frequency band and is the length of digital signal.The scaling factor can be a linear or nonlinear scale.For the discrete transform, can also be in ERB-scale,Bark,Log,or other nonlinear scales.

The corresponding discrete-time inverse transform is:

(18)

Figure3:(A)and(B)are speech waveforms simultaneously recorded in a moving car.The microphones are located at the car visor and drivers lapel,respectively.(C)is after noise reduction using the proposed transform from the waveform in(A). where,,and.We note that approximates to given the limited number of decomposed frequency bands.The above formulas have been ver-i?ed by the following experiments.Also note that(18)can also be applied to compute the inverse continuous WT,where needs to be replaced.

Just as the Fourier Transform has a fast algorithm,the FFT,the fast algorithms for the proposed transform also exists.The most computational intensive components in(17)and(18),the convo-lutions,of both the forward and the inverse transforms can be im-plemented by the FFT.Also,depending on the application,the resolution of the lower frequency bands can be reduced to save the computation.

5.EXPERIMENTS AND DISCUSSIONS Transform Validation:In addition to the theoretical proof,we also validated the proposed transform via real audio data.One of our experiments is to use the speech waveform of a males voice saying the words:two,zero,?ve,as shown in Fig.3(A)as the original data.In the forward transform using(17),we used frequencies between80Hz to5KHz.and to decompose the original data into multiple frequency bands in the Bark scale.In the inverse transform using(18),we synthesized the multiple band output back to speech.When plotted both waveforms before and after the transform,we cannot visualize any difference.We then use the correlation coef?cients as the measurement to compute

Table1:Correlation Coef?cients between the original and synthesized signals using the proposed inverse transform.

No.of Filters8163264

0.740.960.990.99

Figure4:(A)and(B)are from the FFT and the proposed spec-trogram,respectively.They were displayed in the Bark scale from 0to6.4Barks(0to3500KHz).The proposed transform is har-monic free and has less computational noise.The original speech waveform was from Fig.3(A).

the difference.The results are shown in Table1.It validated the proposed forward and inverse transforms derived.It also indicates that32?lters are good for most applications.

Noise Robustness:Using the data in Fig.3(A),we calcu-lated the FFT spectrograms as shown in Fig.4(A),with30ms Hamming window shifting every10ms.To facilitate the compar-ison,we swapped the frequency distribution from linear scale to the Bark scale using the method in[8].The spectrograms from the proposed auditory-based transform is shown in Fig.4(B).They were generated from the output of the proposed transform using the same window size to compute the average densities for each https://www.360docs.net/doc/a2265633.html,paring the two spectrograms in Fig.4,we found that there are no pitch harmonics and less computational noise in the spectrums generated from the proposed transform.This is due to the variable length of?lters.Furthermore,when comparing the spectrums,we found that the proposed transform can gener-ate clear pitch signal for detection and has much less distortion to background noises.

Applications:Fig.3is also an example of applying the pro-posed transform to noise reduction.The original speech,as shown in Fig.3(A),was?rst decomposed into32frequency bands us-ing(17).A voice detector was used to recognize noise and speech using a moving window.A denoising function was then applied to each of the decomposed frequency bands.The inverse trans-form in(18)is then applied to convert the processed signals back to clean speech signal as shown in Fig.3(C),which is similar to the original close talking data in Fig.3(B).

Recently,based on the proposed transform,we have developed a new feature extraction algorithm which has shown signi?cant noise robustness over the MFCC feature in speaker recognition. The result will be published later.

Discussions:In comparison,Eq.(9)is different than the Gam-matone?lters:

(19)where is a function where in(9)is a constant.The deriva-tion of(9)comes from the impulse response experimental results in[1,9].The suggested resynthesis approach for Gammatone[4] is different from the results of the proposed inverse transform.

Compared to the FT,the proposed transform only uses real number computation and is more robust to noises.Its frequency distribution can be in any linear or nonlinear scale.The proposed transform is similar to the continuous WT(CWT);however,the ?lter in(9)is different than existing wavelets.Also,there is no for-mula to compute the inverse CWT numerically.We note that(18) can also be applied to compute the https://www.360docs.net/doc/a2265633.html,pared to discrete-time WT,the frequency response of proposed transform is not lim-ited to the dyadic scale.It can be in any linear or nonlinear scale.

6.CONCLUSIONS

The concept of the proposed transform is to mimic the impulse re-sponses of the basilar membrane and its nonlinear frequency distri-bution characteristics.As the results show,the proposed transform has signi?cant advantages in its noise robustness and its freedom from harmonic distortion and computational noise.These advan-tages can lead to many new applications,such as robust features for speech and speaker recognition,new algorithms for noise re-duction and denosing,speech and music synthesis,audio coding, hearing aid,audio signal processing,etc.In summary,the pro-posed transform is a new time-frequency transform for audio and speech processing and many other applications.

7.ACKNOWLEDGMENT

The author would like to thank Manli Zhu,Yan Huang,and Joshua J.Hajicek for useful discussions.

8.REFERENCES

[1]G.von B′e k′e sy,Experiments in hearing.New York:

McGRAW-HILL,1960.

[2]J.Allen,“Cochlear modeling,”IEEE ASSP Magazine,pp.3–

29,Jan.1985.

[3]P.I.M.Johannesma,“The pre-response stimulus ensemble of

neurons in the cochlear nucleus,”The proceeding of the sym-posium on hearing Theory,vol.IPO,pp.58–69,June1972.

[4]M.Weintraub,A theory and computational model of auditory

monaural sound separation.PhD thesis,Standford University, CA,August1985.

[5]V.Hohmann,“Frequency analysis and synthesis using a Gam-

matone?lterbank,”Acta Acoustica United with Acustica, vol.88,pp.433–442,2002.

[6]Q.Li,“Solution for pervasive speaker recognition,”SBIR

Phase I Proposal,Submitted to NSF IT.F4,Li Creative Tech-nologies,Inc.,NJ,June2003.

[7]R.Rao and A.Bopardikar,Wavelet Transforms.MA:Adison-

Wesley,1998.

[8]Q.Li,F.K.Soong,and S.Olivier,“An auditory system-based

feature for robust speech recognition,”in Proc.7th European Conf.on Speech Communication and Technology,(Denmark), pp.619–622,Sept.2001.

[9]J.P.Wilson and J.Johnstone,“Capacitive probe measures of

basilar membrane vibrations in,”Hearing Theory,1972.

[批处理]计算时间差的函数etime

[批处理]计算时间差的函数etime 计算时间差的函数etime 收藏 https://www.360docs.net/doc/a2265633.html,/thread-4701-1-1.html 这个是脚本代码[保存为etime.bat放在当前路径下即可:免费内容: :etime <begin_time> <end_time> <return> rem 所测试任务的执行时间不超过1天// 骨瘦如柴版setlocal&set be=%~1:%~2&set cc=(%%d-%%a)*360000+(1%%e-1%%b)*6000+1%%f-1% %c&set dy=-8640000 for /f "delims=: tokens=1-6" %%a in ("%be:.=%")do endlocal&set/a %3=%cc%,%3+=%dy%*("%3>> 31")&exit/b ---------------------------------------------------------------------------------------------------------------------------------------- 计算两个时间点差的函数批处理etime 今天兴趣大法思考了好多bat的问题,以至于通宵 在论坛逛看到有个求时间差的"函数"被打搅调用地方不少(大都是测试代码执行效率的) 免费内容: :time0

::计算时间差(封装) @echo off&setlocal&set /a n=0&rem code 随风@https://www.360docs.net/doc/a2265633.html, for /f "tokens=1-8 delims=.: " %%a in ("%~1:%~2") do ( set /a n+=10%%a%%100*360000+10%%b%%100*6000+10%% c%%100*100+10%%d%%100 set /a n-=10%%e%%100*360000+10%%f%%100*6000+10%%g %%100*100+10%%h%%100) set /a s=n/360000,n=n%%360000,f=n/6000,n=n%%6000,m=n/1 00,n=n%%100 set "ok=%s% 小时%f% 分钟%m% 秒%n% 毫秒" endlocal&set %~3=%ok:-=%&goto :EOF 这个代码的算法是统一找时间点凌晨0:00:00.00然后计算任何一个时间点到凌晨的时间差(单位跑秒) 然后任意两个时间点求时间差就是他们相对凌晨时间点的时间数的差 对09这样的非法8进制数的处理用到了一些技巧,还有两个时间参数不分先后顺序,可全可点, 但是这个代码一行是可以省去的(既然是常被人掉用自然体

to与for的用法和区别

to与for的用法和区别 一般情况下, to后面常接对象; for后面表示原因与目的为多。 Thank you for helping me. Thanks to all of you. to sb.表示对某人有直接影响比如,食物对某人好或者不好就用to; for表示从意义、价值等间接角度来说,例如对某人而言是重要的,就用for. for和to这两个介词,意义丰富,用法复杂。这里仅就它们主要用法进行比较。 1. 表示各种“目的” 1. What do you study English for? 你为什么要学英语? 2. She went to france for holiday. 她到法国度假去了。 3. These books are written for pupils. 这些书是为学生些的。 4. hope for the best, prepare for the worst. 作最好的打算,作最坏的准备。 2.对于 1.She has a liking for painting. 她爱好绘画。 2.She had a natural gift for teaching. 她对教学有天赋/ 3.表示赞成同情,用for不用to. 1. Are you for the idea or against it? 你是支持还是反对这个想法? 2. He expresses sympathy for the common people.. 他表现了对普通老百姓的同情。 3. I felt deeply sorry for my friend who was very ill. 4 for表示因为,由于(常有较活译法) 1 Thank you for coming. 谢谢你来。 2. France is famous for its wines. 法国因酒而出名。 5.当事人对某事的主观看法,对于(某人),对…来说(多和形容词连用)用介词to,不用for.. He said that money was not important to him. 他说钱对他并不重要。 To her it was rather unusual. 对她来说这是相当不寻常的。 They are cruel to animals. 他们对动物很残忍。 6.for和fit, good, bad, useful, suitable 等形容词连用,表示适宜,适合。 Some training will make them fit for the job. 经过一段训练,他们会胜任这项工作的。 Exercises are good for health. 锻炼有益于健康。 Smoking and drinking are bad for health. 抽烟喝酒对健康有害。 You are not suited for the kind of work you are doing. 7. for表示不定式逻辑上的主语,可以用在主语、表语、状语、定语中。 1.It would be best for you to write to him. 2.The simple thing is for him to resign at once. 3.There was nowhere else for me to go. 4.He opened a door and stood aside for her to pass.

of与for的用法以及区别

of与for的用法以及区别 for 表原因、目的 of 表从属关系 介词of的用法 (1)所有关系 this is a picture of a classroom (2)部分关系 a piece of paper a cup of tea a glass of water a bottle of milk what kind of football,American of soccer? (3)描写关系 a man of thirty 三十岁的人 a man of shanghai 上海人 (4)承受动作 the exploitation of man by man.人对人的剥削。 (5)同位关系 It was a cold spring morning in the city of London in England. (6)关于,对于 What do you think of Chinese food? 你觉得中国食品怎么样? 介词 for 的用法小结 1. 表示“当作、作为”。如: I like some bread and milk for breakfast. 我喜欢把面包和牛奶作为早餐。What will we have for supper? 我们晚餐吃什么?

2. 表示理由或原因,意为“因为、由于”。如: Thank you for helping me with my English. 谢谢你帮我学习英语。 Thank you for your last letter. 谢谢你上次的来信。 Thank you for teaching us so well. 感谢你如此尽心地教我们。 3. 表示动作的对象或接受者,意为“给……”、“对…… (而言)”。如: Let me pick it up for you. 让我为你捡起来。 Watching TV too much is bad for your health. 看电视太多有害于你的健康。 4. 表示时间、距离,意为“计、达”。如: I usually do the running for an hour in the morning. 我早晨通常跑步一小时。We will stay there for two days. 我们将在那里逗留两天。 5. 表示去向、目的,意为“向、往、取、买”等。如: let’s go for a walk. 我们出去散步吧。 I came here for my schoolbag.我来这儿取书包。 I paid twenty yuan for the dictionary. 我花了20元买这本词典。 6. 表示所属关系或用途,意为“为、适于……的”。如: It’s time for school. 到上学的时间了。 Here is a letter for you. 这儿有你的一封信。 7. 表示“支持、赞成”。如: Are you for this plan or against it? 你是支持还是反对这个计划? 8. 用于一些固定搭配中。如: Who are you waiting for? 你在等谁? For example, Mr Green is a kind teacher. 比如,格林先生是一位心地善良的老师。

延时子程序计算方法

学习MCS-51单片机,如果用软件延时实现时钟,会接触到如下形式的延时子程序:delay:mov R5,#data1 d1:mov R6,#data2 d2:mov R7,#data3 d3:djnz R7,d3 djnz R6,d2 djnz R5,d1 Ret 其精确延时时间公式:t=(2*R5*R6*R7+3*R5*R6+3*R5+3)*T (“*”表示乘法,T表示一个机器周期的时间)近似延时时间公式:t=2*R5*R6*R7 *T 假如data1,data2,data3分别为50,40,248,并假定单片机晶振为12M,一个机器周期为10-6S,则10分钟后,时钟超前量超过1.11秒,24小时后时钟超前159.876秒(约2分40秒)。这都是data1,data2,data3三个数字造成的,精度比较差,建议C描述。

上表中e=-1的行(共11行)满足(2*R5*R6*R7+3*R5*R6+3*R5+3)=999,999 e=1的行(共2行)满足(2*R5*R6*R7+3*R5*R6+3*R5+3)=1,000,001 假如单片机晶振为12M,一个机器周期为10-6S,若要得到精确的延时一秒的子程序,则可以在之程序的Ret返回指令之前加一个机器周期为1的指令(比如nop指令), data1,data2,data3选择e=-1的行。比如选择第一个e=-1行,则精确的延时一秒的子程序可以写成: delay:mov R5,#167 d1:mov R6,#171 d2:mov R7,#16 d3:djnz R7,d3 djnz R6,d2

djnz R5,d1 nop ;注意不要遗漏这一句 Ret 附: #include"iostReam.h" #include"math.h" int x=1,y=1,z=1,a,b,c,d,e(999989),f(0),g(0),i,j,k; void main() { foR(i=1;i<255;i++) { foR(j=1;j<255;j++) { foR(k=1;k<255;k++) { d=x*y*z*2+3*x*y+3*x+3-1000000; if(d==-1) { e=d;a=x;b=y;c=z; f++; cout<<"e="<

用c++编写计算日期的函数

14.1 分解与抽象 人类解决复杂问题采用的主要策略是“分而治之”,也就是对问题进行分解,然后分别解决各个子问题。著名的计算机科学家Parnas认为,巧妙的分解系统可以有效地系统的状态空间,降低软件系统的复杂性所带来的影响。对于复杂的软件系统,可以逐个将它分解为越来越小的组成部分,直至不能分解为止。这样在小的分解层次上,人就很容易理解并实现了。当所有小的问题解决完毕,整个大的系统也就解决完毕了。 在分解过程中会分解出很多类似的小问题,他们的解决方式是一样的,因而可以把这些小问题,抽象出来,只需要给出一个实现即可,凡是需要用到该问题时直接使用即可。 案例日期运算 给定日期由年、月、日(三个整数,年的取值在1970-2050之间)组成,完成以下功能: (1)判断给定日期的合法性; (2)计算两个日期相差的天数; (3)计算一个日期加上一个整数后对应的日期; (4)计算一个日期减去一个整数后对应的日期; (5)计算一个日期是星期几。 针对这个问题,很自然想到本例分解为5个模块,如图14.1所示。 图14.1日期计算功能分解图 仔细分析每一个模块的功能的具体流程: 1. 判断给定日期的合法性: 首先判断给定年份是否位于1970到2050之间。然后判断给定月份是否在1到12之间。最后判定日的合法性。判定日的合法性与月份有关,还涉及到闰年问题。当月份为1、3、5、7、8、10、12时,日的有效范围为1到31;当月份为4、6、9、11时,日的有效范围为1到30;当月份为2时,若年为闰年,日的有效范围为1到29;当月份为2时,若年不为闰年,日的有效范围为1到28。

图14.2日期合法性判定盒图 判断日期合法性要要用到判断年份是否为闰年,在图14.2中并未给出实现方法,在图14.3中给出。 图14.3闰年判定盒图 2. 计算两个日期相差的天数 计算日期A (yearA 、monthA 、dayA )和日期B (yearB 、monthB 、dayB )相差天数,假定A 小于B 并且A 和B 不在同一年份,很自然想到把天数分成3段: 2.1 A 日期到A 所在年份12月31日的天数; 2.2 A 之后到B 之前的整年的天数(A 、B 相邻年份这部分没有); 2.3 B 日期所在年份1月1日到B 日期的天数。 A 日期 A 日期12月31日 B 日期 B 日期1月1日 整年部分 整年部分 图14.4日期差分段计算图 若A 小于B 并且A 和B 在同一年份,直接在年内计算。 2.1和2.3都是计算年内的一段时间,并且涉及到闰年问题。2.2计算整年比较容易,但

常用介词用法(for to with of)

For的用法 1. 表示“当作、作为”。如: I like some bread and milk for breakfast. 我喜欢把面包和牛奶作为早餐。 What will we have for supper? 我们晚餐吃什么? 2. 表示理由或原因,意为“因为、由于”。如: Thank you for helping me with my English. 谢谢你帮我学习英语。 3. 表示动作的对象或接受者,意为“给……”、“对…… (而言)”。如: Let me pick it up for you. 让我为你捡起来。 Watching TV too much is bad for your health. 看电视太多有害于你的健康。 4. 表示时间、距离,意为“计、达”。如: I usually do the running for an hour in the morning. 我早晨通常跑步一小时。 We will stay there for two days. 我们将在那里逗留两天。 5. 表示去向、目的,意为“向、往、取、买”等。如: Let’s go for a walk. 我们出去散步吧。 I came here for my schoolbag.我来这儿取书包。 I paid twenty yuan for the dictionary. 我花了20元买这本词典。 6. 表示所属关系或用途,意为“为、适于……的”。如: It’s time for school. 到上学的时间了。 Here is a letter for you. 这儿有你的一封信。 7. 表示“支持、赞成”。如: Are you for this plan or against it? 你是支持还是反对这个计划? 8. 用于一些固定搭配中。如: Who are you waiting for? 你在等谁? For example, Mr Green is a kind teacher. 比如,格林先生是一位心地善良的老师。 尽管for 的用法较多,但记住常用的几个就可以了。 to的用法: 一:表示相对,针对 be strange (common, new, familiar, peculiar) to This injection will make you immune to infection. 二:表示对比,比较 1:以-ior结尾的形容词,后接介词to表示比较,如:superior ,inferior,prior,senior,junior 2: 一些本身就含有比较或比拟意思的形容词,如equal,similar,equivalent,analogous A is similar to B in many ways.

Excel中如何计算日期差

Excel中如何计算日期差: ----Excel中最便利的工作表函数之一——Datedif名不见经传,但却十分好用。Datedif能返回任意两个日期之间相差的时间,并能以年、月或天数的形式表示。您可以用它来计算发货单到期的时间,还可以用它来进行2000年的倒计时。 ----Excel中的Datedif函数带有3个参数,其格式如下: ----=Datedif(start_date,end_date,units) ----start_date和end_date参数可以是日期或者是代表日期的变量,而units则是1到2个字符长度的字符串,用以说明返回日期差的形式(见表1)。图1是使用Datedif函数的一个例子,第2行的值就表明这两个日期之间相差1年又14天。units的参数类型对应的Datedif返回值 “y”日期之差的年数(非四舍五入) “m”日期之差的月数(非四舍五入) “d”日期之差的天数(非四舍五入) “md”两个日期相减后,其差不足一个月的部分的天数 “ym”两个日期相减后,其差不足一年的部分的月数 “yd”两个日期相减后,其差不足一年的部分的天数

表1units参数的类型及其含义 图1可以通过键入3个带有不同参数的Datedif公式来计算日期的差。units的参数类型 ----图中:单元格Ex为公式“=Datedif(Cx,Dx,“y”)”得到的结果(x=2,3,4......下同) ----Fx为公式“=Datedif(Cx,Dx,“ym”)”得到的结果 ----Gx为公式“=Datedif(Cx,Dx,“md”)”得到的结果 现在要求两个日期之间相差多少分钟,units参数是什么呢? 晕,分钟你不能用天数乘小时再乘分钟吗? units的参数类型对应的Datedif返回值 “y”日期之差的年数(非四舍五入) “m”日期之差的月数(非四舍五入) “d”日期之差的天数(非四舍五入) “md”两个日期相减后,其差不足一个月的部分的天数 “ym”两个日期相减后,其差不足一年的部分的月数 “yd”两个日期相减后,其差不足一年的部分的天数 假设你的数据从A2和B2开始,在C2里输入下面公式,然后拖拉复制。 =IF(TEXT(A2,"h:mm:ss")

of和for的用法

of 1....的,属于 One of the legs of the table is broken. 桌子的一条腿坏了。 Mr.Brown is a friend of mine. 布朗先生是我的朋友。 2.用...做成的;由...制成 The house is of stone. 这房子是石建的。 3.含有...的;装有...的 4....之中的;...的成员 Of all the students in this class,Tom is the best. 在这个班级中,汤姆是最优秀的。 5.(表示同位) He came to New York at the age of ten. 他在十岁时来到纽约。 6.(表示宾格关系) He gave a lecture on the use of solar energy. 他就太阳能的利用作了一场讲演。 7.(表示主格关系) We waited for the arrival of the next bus. 我们等待下一班汽车的到来。

I have the complete works of Shakespeare. 我有莎士比亚全集。 8.来自...的;出自 He was a graduate of the University of Hawaii. 他是夏威夷大学的毕业生。 9.因为 Her son died of hepatitis. 她儿子因患肝炎而死。 10.在...方面 My aunt is hard of hearing. 我姑妈耳朵有点聋。 11.【美】(时间)在...之前 12.(表示具有某种性质) It is a matter of importance. 这是一件重要的事。 For 1.为,为了 They fought for national independence. 他们为民族独立而战。 This letter is for you. 这是你的信。

单片机C延时时间怎样计算

C程序中可使用不同类型的变量来进行延时设计。经实验测试,使用unsigned char类型具有比unsigned int更优化的代码,在使用时 应该使用unsigned char作为延时变量。以某晶振为12MHz的单片 机为例,晶振为12M H z即一个机器周期为1u s。一. 500ms延时子程序 程序: void delay500ms(void) { unsigned char i,j,k; for(i=15;i>0;i--) for(j=202;j>0;j--) for(k=81;k>0;k--); } 计算分析: 程序共有三层循环 一层循环n:R5*2 = 81*2 = 162us DJNZ 2us 二层循环m:R6*(n+3) = 202*165 = 33330us DJNZ 2us + R5赋值 1us = 3us 三层循环: R7*(m+3) = 15*33333 = 499995us DJNZ 2us + R6赋值 1us = 3us

循环外: 5us 子程序调用 2us + 子程序返回2us + R7赋值 1us = 5us 延时总时间 = 三层循环 + 循环外 = 499995+5 = 500000us =500ms 计算公式:延时时间=[(2*R5+3)*R6+3]*R7+5 二. 200ms延时子程序 程序: void delay200ms(void) { unsigned char i,j,k; for(i=5;i>0;i--) for(j=132;j>0;j--) for(k=150;k>0;k--); } 三. 10ms延时子程序 程序: void delay10ms(void) { unsigned char i,j,k; for(i=5;i>0;i--) for(j=4;j>0;j--) for(k=248;k>0;k--);

for和to区别

1.表示各种“目的”,用for (1)What do you study English for 你为什么要学英语? (2)went to france for holiday. 她到法国度假去了。 (3)These books are written for pupils. 这些书是为学生些的。 (4)hope for the best, prepare for the worst. 作最好的打算,作最坏的准备。 2.“对于”用for (1)She has a liking for painting. 她爱好绘画。 (2)She had a natural gift for teaching. 她对教学有天赋/ 3.表示“赞成、同情”,用for (1)Are you for the idea or against it 你是支持还是反对这个想法? (2)He expresses sympathy for the common people.. 他表现了对普通老百姓的同情。 (3)I felt deeply sorry for my friend who was very ill. 4. 表示“因为,由于”(常有较活译法),用for (1)Thank you for coming. 谢谢你来。

(2)France is famous for its wines. 法国因酒而出名。 5.当事人对某事的主观看法,“对于(某人),对…来说”,(多和形容词连用),用介词to,不用for. (1)He said that money was not important to him. 他说钱对他并不重要。 (2)To her it was rather unusual. 对她来说这是相当不寻常的。 (3)They are cruel to animals. 他们对动物很残忍。 6.和fit, good, bad, useful, suitable 等形容词连用,表示“适宜,适合”,用for。(1)Some training will make them fit for the job. 经过一段训练,他们会胜任这项工作的。 (2)Exercises are good for health. 锻炼有益于健康。 (3)Smoking and drinking are bad for health. 抽烟喝酒对健康有害。 (4)You are not suited for the kind of work you are doing. 7. 表示不定式逻辑上的主语,可以用在主语、表语、状语、定语中。 (1)It would be best for you to write to him. (2) The simple thing is for him to resign at once.

51单片机延时时间计算和延时程序设计

一、关于单片机周期的几个概念 ●时钟周期 时钟周期也称为振荡周期,定义为时钟脉冲的倒数(可以这样来理解,时钟周期就是单片机外接晶振的倒数,例如12MHz的晶振,它的时间周期就是1/12 us),是计算机中最基本的、最小的时间单位。 在一个时钟周期内,CPU仅完成一个最基本的动作。 ●机器周期 完成一个基本操作所需要的时间称为机器周期。 以51为例,晶振12M,时钟周期(晶振周期)就是(1/12)μs,一个机器周期包 执行一条指令所需要的时间,一般由若干个机器周期组成。指令不同,所需的机器周期也不同。 对于一些简单的的单字节指令,在取指令周期中,指令取出到指令寄存器后,立即译码执行,不再需要其它的机器周期。对于一些比较复杂的指令,例如转移指令、乘法指令,则需要两个或者两个以上的机器周期。 1.指令含义 DJNZ:减1条件转移指令 这是一组把减1与条件转移两种功能结合在一起的指令,共2条。 DJNZ Rn,rel ;Rn←(Rn)-1 ;若(Rn)=0,则PC←(PC)+2 ;顺序执行 ;若(Rn)≠0,则PC←(PC)+2+rel,转移到rel所在位置DJNZ direct,rel ;direct←(direct)-1 ;若(direct)= 0,则PC←(PC)+3;顺序执行 ;若(direct)≠0,则PC←(PC)+3+rel,转移到rel 所在位置 2.DJNZ Rn,rel指令详解 例:

MOV R7,#5 DEL:DJNZ R7,DEL; rel在本例中指标号DEL 1.单层循环 由上例可知,当Rn赋值为几,循环就执行几次,上例执行5次,因此本例执行的机器周期个数=1(MOV R7,#5)+2(DJNZ R7,DEL)×5=11,以12MHz的晶振为例,执行时间(延时时间)=机器周期个数×1μs=11μs,当设定立即数为0时,循环程序最多执行256次,即延时时间最多256μs。 2.双层循环 1)格式: DELL:MOV R7,#bb DELL1:MOV R6,#aa DELL2:DJNZ R6,DELL2; rel在本句中指标号DELL2 DJNZ R7,DELL1; rel在本句中指标号DELL1 注意:循环的格式,写错很容易变成死循环,格式中的Rn和标号可随意指定。 2)执行过程

excel中计算日期差工龄生日等方法

excel中计算日期差工龄生日等方法 方法1:在A1单元格输入前面的日期,比如“2004-10-10”,在A2单元格输入后面的日期,如“2005-6-7”。接着单击A3单元格,输入公式“=DATEDIF(A1,A2,"d")”。然后按下回车键,那么立刻就会得到两者的天数差“240”。 提示:公式中的A1和A2分别代表前后两个日期,顺序是不可以颠倒的。此外,DATEDIF 函数是Excel中一个隐藏函数,在函数向导中看不到它,但这并不影响我们的使用。 方法2:任意选择一个单元格,输入公式“="2004-10-10"-"2005-6-7"”,然后按下回车键,我们可以立即计算出结果。 计算工作时间——工龄—— 假如日期数据在D2单元格。 =DA TEDIF(D2,TODAY(),"y")+1 注意:工龄两头算,所以加“1”。 如果精确到“天”—— =DA TEDIF(D2,TODAY(),"y")&"年"&DATEDIF(D2,TODAY(),"ym")&"月"&DATEDIF(D2,TODAY(),"md")&"日" 二、计算2003-7-617:05到2006-7-713:50分之间相差了多少天、多少个小时多少分钟 假定原数据分别在A1和B1单元格,将计算结果分别放在C1、D1和E1单元格。 C1单元格公式如下: =ROUND(B1-A1,0) D1单元格公式如下: =(B1-A1)*24 E1单元格公式如下: =(B1-A1)*24*60 注意:A1和B1单元格格式要设为日期,C1、D1和E1单元格格式要设为常规. 三、计算生日,假设b2为生日

=datedif(B2,today(),"y") DA TEDIF函数,除Excel2000中在帮助文档有描述外,其他版本的Excel在帮助文档中都没有说明,并且在所有版本的函数向导中也都找不到此函数。但该函数在电子表格中确实存在,并且用来计算两个日期之间的天数、月数或年数很方便。微软称,提供此函数是为了与Lotus1-2-3兼容。 该函数的用法为“DA TEDIF(Start_date,End_date,Unit)”,其中Start_date为一个日期,它代表时间段内的第一个日期或起始日期。End_date为一个日期,它代表时间段内的最后一个日期或结束日期。Unit为所需信息的返回类型。 “Y”为时间段中的整年数,“M”为时间段中的整月数,“D”时间段中的天数。“MD”为Start_date与End_date日期中天数的差,可忽略日期中的月和年。“YM”为Start_date与End_date日期中月数的差,可忽略日期中的日和年。“YD”为Start_date与End_date日期中天数的差,可忽略日期中的年。比如,B2单元格中存放的是出生日期(输入年月日时,用斜线或短横线隔开),在C2单元格中输入“=datedif(B2,today(),"y")”(C2单元格的格式为常规),按回车键后,C2单元格中的数值就是计算后的年龄。此函数在计算时,只有在两日期相差满12个月,才算为一年,假如生日是2004年2月27日,今天是2005年2月28日,用此函数计算的年龄则为0岁,这样算出的年龄其实是最公平的。 本篇文章来源于:实例教程网(https://www.360docs.net/doc/a2265633.html,) 原文链接:https://www.360docs.net/doc/a2265633.html,/bgruanjian/excel/631.html

双宾语tofor的用法

1. 两者都可以引出间接宾语,但要根据不同的动词分别选用介词to 或for: (1) 在give, pass, hand, lend, send, tell, bring, show, pay, read, return, write, offer, teach, throw 等之后接介词to。 如: 请把那本字典递给我。 正:Please hand me that dictionary. 正:Please hand that dictionary to me. 她去年教我们的音乐。 正:She taught us music last year. 正:She taught music to us last year. (2) 在buy, make, get, order, cook, sing, fetch, play, find, paint, choose,prepare, spare 等之后用介词for 。如: 他为我们唱了首英语歌。 正:He sang us an English song. 正:He sang an English song for us. 请帮我把钥匙找到。 正:Please find me the keys. 正:Please find the keys for me. 能耽搁你几分钟吗(即你能为我抽出几分钟吗)? 正:Can you spare me a few minutes? 正:Can you spare a few minutes for me? 注:有的动词由于搭配和含义的不同,用介词to 或for 都是可能的。如: do sb a favou r do a favour for sb 帮某人的忙 do sb harnn= do harm to sb 对某人有害

for和of的用法

for的用法: 1. 表示“当作、作为”。如: I like some bread and milk for breakfast. 我喜欢把面包和牛奶作为早餐。 What will we have for supper? 我们晚餐吃什么? 2. 表示理由或原因,意为“因为、由于”。如: Thank you for helping me with my English. 谢谢你帮我学习英语。 Thank you for your last letter. 谢谢你上次的来信。 Thank you for teaching us so well. 感谢你如此尽心地教我们。 3. 表示动作的对象或接受者,意为“给……”、“对…… (而言)”。如: Let me pick it up for you. 让我为你捡起来。 Watching TV too much is bad for your health. 看电视太多有害于你的健康。 4. 表示时间、距离,意为“计、达”。如:

I usually do the running for an hour in the morning. 我早晨通常跑步一小时。 We will stay there for two days. 我们将在那里逗留两天。 5. 表示去向、目的,意为“向、往、取、买”等。如: Let’s go for a walk. 我们出去散步吧。 I came here for my schoolbag.我来这儿取书包。 I paid twenty yuan for the dictionary. 我花了20元买这本词典。 6. 表示所属关系或用途,意为“为、适于……的”。如: It’s time for school. 到上学的时间了。 Here is a letter for you. 这儿有你的一封信。 7. 表示“支持、赞成”。如: Are you for this plan or against it? 你是支持还是反对这个计划? 8. 用于一些固定搭配中。如:

英语形容词和of for 的用法

加入收藏夹 主题: 介词试题It’s + 形容词 + of sb. to do sth.和It’s + 形容词 + for sb. to do sth.的用法区别。 内容: It's very nice___pictures for me. A.of you to draw B.for you to draw C.for you drawing C.of you drawing 提交人:杨天若时间:1/23/2008 20:5:54 主题:for 与of 的辨别 内容:It's very nice___pictures for me. A.of you to draw B.for you to draw C.for you drawing C.of you drawing 答:选A 解析:该题考查的句型It’s + 形容词+ of sb. to do sth.和It’s +形容词+ for sb. to do sth.的用法区别。 “It’s + 形容词+ to do sth.”中常用of或for引出不定式的行为者,究竟用of sb.还是用for sb.,取决于前面的形容词。 1) 若形容词是描述不定式行为者的性格、品质的,如kind,good,nice,right,wrong,clever,careless,polite,foolish等,用of sb. 例: It’s very kind of you to help me. 你能帮我,真好。 It’s clever of you to work out the maths problem. 你真聪明,解出了这道数学题。 2) 若形容词仅仅是描述事物,不是对不定式行为者的品格进行评价,用for sb.,这类形容词有difficult,easy,hard,important,dangerous,(im)possible等。例: It’s very dangerous for children to cross the busy street. 对孩子们来说,穿过繁忙的街道很危险。 It’s difficult for u s to finish the work. 对我们来说,完成这项工作很困难。 for 与of 的辨别方法: 用介词后面的代词作主语,用介词前边的形容词作表语,造个句子。如果道理上通顺用of,不通则用for. 如: You are nice.(通顺,所以应用of)。 He is hard.(人是困难的,不通,因此应用for.) 由此可知,该题的正确答案应该为A项。 提交人:f7_liyf 时间:1/24/2008 11:18:42

to和for的用法有什么不同(一)

to和for的用法有什么不同(一) 一、引出间接宾语时的区别 两者都可以引出间接宾语,但要根据不同的动词分别选用介词to 或for,具体应注意以下三种情况: 1. 在give, pass, hand, lend, send, tell, bring, show, pay, read, return, write, offer, teach, throw 等之后接介词to。如: 请把那本字典递给我。 正:Please hand me that dictionary. 正:Please hand that dictionary to me. 她去年教我们的音乐。 正:She taught us music last year. 正:She taught music to us last year. 2. 在buy, make, get, order, cook, sing, fetch, play, find, paint, choose, prepare, spare 等之后用介词for 。如: 他为我们唱了首英语歌。 正:He sang us an English song. 正:He sang an English song for us. 请帮我把钥匙找到。 正:Please find me the keys. 正:Please find the keys for me. 能耽搁你几分钟吗(即你能为我抽出几分钟吗)? 正:Can you spare me a few minutes?

正:Can you spare a few minutes for me? 3. 有的动词由于用法和含义不同,用介词to 或for 都是可能的。如: do sb a favor=do a favor for sb 帮某人的忙 do sb harm=do harm to sb 对某人有害 在有的情况下,可能既不用for 也不用to,而用其他的介词。如: play sb a trick=play a trick on sb 作弄某人 请比较: play sb some folk songs=play some folk songs for sb 给某人演奏民歌 有时同一个动词,由于用法不同,所搭配的介词也可能不同,如leave sbsth 这一结构,若表示一般意义的为某人留下某物,则用介词for 引出间接宾语,即说leave sth for sb;若表示某人死后遗留下某物,则用介词to 引出间接宾语,即说leave sth to sb。如: Would you like to leave him a message? / Would you like to leave a message for him? 你要不要给他留个话? Her father left her a large fortune. / Her father left a large fortune to her. 她父亲死后给她留下了一大笔财产。 二、表示目标或方向的区别 两者均可表示目标、目的地、方向等,此时也要根据不同动词分别对待。如: 1. 在come, go, walk, move, fly, ride, drive, march, return 等动词之后通常用介词to 表示目标或目的地。如: He has gone to Shanghai. 他到上海去了。 They walked to a river. 他们走到一条河边。

相关文档
最新文档