A Battery-free Object Localization and Motion Sensing

A Battery-free Object Localization and Motion Sensing
A Battery-free Object Localization and Motion Sensing

A Battery-free Object Localization and Motion Sensing

Platform

Yi Zhao

EE Dept. University of Washington yizhao@https://www.360docs.net/doc/9013788536.html,

Anthony LaMarca

Intel Research

https://www.360docs.net/doc/9013788536.html,marca@https://www.360docs.net/doc/9013788536.html,

Joshua R.Smith

CSE&EE Dept.

University of Washington

jrs@https://www.360docs.net/doc/9013788536.html,

ABSTRACT

Indoor object localization can enable many ubicomp applica-tions,such as asset tracking and object-related activity recog-nition.Most location and tracking systems rely on either battery-powered devices which create cost and maintenance issues or cameras which have accuracy and privacy issues. This paper introduces a system that is able to detect the3D position and motion of a battery-free RFID tag embedded with an ultrasound detector and an https://www.360docs.net/doc/9013788536.html,bining tags’acceleration with location improves the system’s power management and supports activity recognition.We charac-terize the system’s localization performance in open space as well as in a cluttered wet lab environment.The system is used to track real-time location and motion of the tags as well as recognize actions performed on the objects to which the tag is attached.The median localization accuracy is7.6cm–(3.1,5,1.9)cm for each(x,y,z)axis–with max update rates of15Sample/s using single RFID reader antenna.

Author Keywords

RFID;localization;Object tracking;Activity Recognition ACM Classi?cation Keywords

C.2.4Distributed Systems:Distributed Applications

1.INTRODUCTION

Accurate3D object location is one of the key context infor-mation enabling many smart home and smart of?ce capabil-ities,such as activity inference,asset tracking,and human-robot interaction.Unfortunately,most localization systems are based on either cameras[10]or battery-powered dis-tributed sensing devices[4,6].Camera-based systems cre-ate a host of privacy issues and have trouble localizing trans-parent,re?ective and irregular-shape objects.The latter sys-tems typically have better accuracy and identi?cation ability, but don’t scale well due to tag size,battery life and mone-tary and maintenance costs of the active sensors,especially in dense localization sensor network.RF wireless power technology[3,5,11]can power varied sensing devices by available RF infrastructure rather than battery,such as pas-sive RFID tags.Those RFID tags are small,cheap and have Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for pro?t or commercial advantage and that copies bear this notice and the full cita-tion on the?rst page.Copyrights for components of this work owned by others than ACM must be honored.Abstracting with credit is permitted.To copy otherwise,or re-publish,to post on servers or to redistribute to lists,requires prior speci?c permission and/or a fee.Request permissions from Permissions@https://www.360docs.net/doc/9013788536.html,.

Ubicomp′14,September13-172014,Seattle,WA,USA

Copyright c 2014ACM978-1-4503-2968-2/14/09˙..$15.00

https://www.360docs.net/doc/9013788536.html,/10.1145/2632048.2632078long life-time due to its battery-free,thereby having potential as low-cost localization system.Besides,the RFID proto-cols are optimized for reading dense tag population,therefore allowing good scaling.Current RFID localization systems can provide at best sub-meter level coarse localization using RF signal strength.However,researchers have to deal with the trade-off between low accuracy due to RF multi-path and high-cost because of using large number of RFID reference nodes[2].

To address these issues,this paper introduces the?rst battery-free acoustic localization platform based on RFID infras-tructure.In previous work,we demonstrated that a passive RFID tag augmented with an ultrasonic microphone can ac-curately estimate its range from an ultrasonic transmitter[11]. In this work,both our ultrasonic transmitters and receivers were built-into fully-programmable passive tags(Figure1) named WISPs(Wireless Identi?cation Battery-free Sensing Platform[9]),which were augmented with either ultrasound beacons or ultrasound microphones and accelerometers.By having all of the ultrasonic sensing and actuation in the tag, we can make use of commercial RFID readers to power and communicate with the tags.In this paper,we show that this basic acoustic ranging capability can be extended to robust, accurate3D localization in a lab environment.We do this by having tags perform ultrasound time of?ight(ToF)mea-surements to estimate its range to four ultrasonic transmitters in known locations.These ranging estimates infer the tag’s 3D location relative to the transmitters by applying a translit-eration method that can mitigate the effect of indirect-path and multi-path acoustic re?ections.The result is a scalable, battery-free3D localization system with the following fea-tures:

?7.6cm accuracy overall with(3.1,5,1.9)cm accuracy for each(x,y,z)axis for line of sight stationary tags.

?Average update rate of153D location estimates per second (given1W RF power and1.8m test range).

?Maximum range of3.5m(at best RF sensitive

direction). Figure1.A battery-free ultrasonic localization tag that is powered and read by RF signals.

Figure2.Sensing and communication protocol:in the blue area,the Sense WISP is awake;in the white region,it asleep.

?252μJ Energy consumption for positioned tag updating one location measurement.

?Tolerance to ultrasound echo noise.

?Wireless powered acoustic transmitters that allow more freedom for system set-up.

?Accelerometer data which accompanies location estimates. This enables both motion and activity estimation as well as improves tag’s power management

2SYSTEM ARCHITECTURE

Our system is designed to allow an customized RFID tag to detect the time of arrival(ToA)of ultrasound sending from four ultrasound transmitters,and to measure its3-axis accel-eration data.The tag will then send back these results back to one RFID reader in range using its Electronic Product Code (EPC)(tag’s ID).Finally,the RFID reader will report all tag readings to a client to compute the tag-to-transmitter distance ranges,and from that estimate the tag’s?nal3D location and motion state.To simplify the explanation,we use a basic two tags system to demonstrate how to localize a target tag us-ing single RFID tag,antenna and reader.The basic system consists of three hardware parts as follows and the design of hardware can be found in previous work[11]:

2.1Sense WISP

The Sense WISP is the target tag to be positioned,which is a battery-free programmable RFID tag(Figure1)augmented with an ultrasound detector and3D accelerometer.This small tag is compatible with RFID UHF EPC Gen2protocol.We are intended to use commercial RFID reader and another ref-erence RFID tag(called Spy WISP)to estimates the3D lo-cation of the Sense WISP.The Spy WISP sent ultrasound from its four ultrasonic beacons.All RFID tag mentioned in this work is wireless powered by1W RF signals sent from single nearby RFID reader antenna.During the step of the RFID protocol called the”Inventory Round”,the Sense WISP starts a timer in anticipation of the?rst ultrasound pulse be-ing simultaneously sent from the Spy WISP and then mea-sures the Time of arrival(ToA)of all four sent ultrasound signals.Time-division multiplexing is used to schedule4ul-trasound transmission and detection within one RFID inven-tory round.To avoid interference between ultrasound signals from different emitters in different RFID reading rounds,the Spy WISP con?nes all of its ultrasound signals to a10ms window.This is the minimum“inventory period”needed by the RFID reader to update one Sense WISP EPC read-ing.The intervals between ultrasound pulses are chosen to be long enough that ultrasound collisions cannot occur.After ultrasound measurement,the Sense WISP samples its3D ac-celeration and send all those data back to the reader.The data being sent encodes the RFID readings along with tag’s unique ID(that is the Electronic Product Code(EPC))(Figure2).The accelerometer in the Sense WISP has built-in activity and in-activity detection circuitry and can measure up to±2G with 16mG sensitivity.

2.2Spy WISP

The Spy WISP RFID tag is in many ways like the Sense WISP tag:It is also a passive RFID tag and can understand and follow the EPC protocol.Unlike the Sense WISP,how-ever,the Spy WISP tag does not acknowledge any radio re-sponses to the RFID reader,nor does perform any sensing.In-stead,the Spy WISP is equipped with425kHZ narrow band ultrasound beacons at known location.The Spy WISP’s func-tion is to transmit an ultrasonic pulse from each beacons at a time known to the Sense WISP(Figure2).The Spy WISP synchronizes the Sense WISP by listening a hard-coded in-formation in RFID command sent from reader to Sense WISP in each tag inventory round.The details of synchronization method can be found in previous paper[11].In a brief,the ToA measurements are achieved using the EPC protocol it-self:Both the Sense WISP and Spy WISP listen for the start of the”Inventory Round”of the EPC protocol.On observ-ing the signal,the Spy WISP emits a sequence of ultrasound pulses at known intervals.The Sense WISP using this sig-nal to start a time and being listening for the ultrasonic chips. Since the EPC protocol signals are sent via radio,both tags will receive and recognize the signal at the nearly the same time and from the perspective of acoustic wave speeds,any difference is negligible.Since the Spy WISP does not send any radio replies,it does not interfere with any tags replying to the reader’s read requests.As it turns out,the transmission of ultrasound makes the Spy WISP more power hungry than Sense WISP,it thus it has to be placed within1m of the RFID antenna.The result,however,is an extremely?exible system with mobile,battery-free tags along with a small number of battery and wire-free reference tags to be placed in the envi-ronment,independent from the reader.

2.3RFID Reader and Client Application

We use an Impinj EPC Gen2UHF reader to power and com-municate with the Sense WISP by issuing inventory com-mands.By sending valid inventory commands to the Sense WISP,the reader helps to triggers the acoustic transmission from transmitters in the Spy WISP and detection of the ToA in Sense WISP.In response,the Sense WISP will passively re-?ect back to reader its EPC information(include Sense WISP

ID,4ToA measurement results,3axis acceleration data,mo-tion activity state from previous inventory round)(Figure2), which is used for inferring tag’s location and motion state. SOFTWARE DESIGN

3.13D Location Calibration

In general,the time of arrival of ultrasound signals in a given environment is linearly proportional to the distance it prop-agated.However,the hardware and sensor introduces some synchronization error.Therefore,we use a?rst order poly-nomial line?t model to matching Sense WISP-to-transmitter

distance d T

i and its ToA measurement result T R

i

.The line?t

model can be expressed as d T i=a i×T R

i +b i(i=1,2,3).

Using this model,the small RF synchronization offset,Sense WISP detection clock offset can be modeled in b i,and the speed of sound variance can be modeled in a i.After that,we can calculate the position of Sense WISP with these calcu-lated distances d T i and transmitter position(x i,y i,z i)using a trilateration algorithm[7].Besides,a time and tag’s motion weighted Kalman?lter is used to?lter out measurement and environmental noise.A python based RFID localization ap-plication GUI is developed to visualize real time tag tracking result.(The GUI uses a python reader client packages from [8])

3.2Power Optimization

The?rmware and hardware of the Sense and Spy WISP are optimized for low power and duty cycled during RFID com-munication and ultrasound detection(Figure2).The Sense WISP only consumes about80μW during a wake up cycle and10μW for a sleep cycle.As a result,the system is able to more accurately track static or slow-moving tags than ones moving quickly.As a further optimization,stationary tags don’t need to perform their location estimation continually since they are not moving.We use the accelerometer data on Sense WISP to implement this power-savings.Once the tag is detected to be stationary,a Sense WISP will increase its sleep cycle length,once motion is resumed,will increase the localization update rate to track its new position.

4EXPERIMENT AND PERFORMANCE

We test the system with single Spy WISP and single Sense WISP to be located in a1.2m?1.2m?1.8m open space and test with more Sense WISPs in a Wet Lab later.The Spy WISP’s four ultrasound transmitters are placed at the4ver-tices of15cm-long square with known location which are in line of sight for the Sense WISP.We use only one reader pro-duces1W power with single antenna(6dBi gain),which can power up Sense WISP up to3.5m away in best sensitive direc-tion.The total energy used for Sense WISP updating one3D location is below252μJ.The experimental results are shown in Figures3and4.In theory,using the RFID synchronization and acoustic TDMA method[11],the system can support lo-calizing up to65535Sense WISPs,however,the localization update rate for each tag will relatively decrease if the system scales up.

Accuracy:Because of the geometry setup of the ultrasounds transmitters,the system can obtain better accuracy in z

axis,Figure3.Free space localization performance:CDF of localization error distribution,in percentage and absolute units.

which is perpendicular to the planes of transmitters.3D ge-ometry setup of those transmitters can improve the accuracy for other axis,however,the ground truth measurement for that is challenging for experiment.Figure4shows that ac-curacy decreases as the Sense WISP-to-transmitters distance or ultrasound angle of arrival increase.Because the attenu-ation of ultrasound and directional ultrasound sensor intro-duces non-liner noise which can not be modeled well using line-?tting model at those circumstance.The average accu-racy is(3.1,5,1.9)cm for each(x,y,z)direction within test-ing range.

Range:The system maximum localization range is3.4m (when x=0,y=0,z=3.4m).The range of the system is limited by the amount of available power for Sense WISP, that means when the Sense WISP is out of the range,it is not able to powered up or complete one detection.

Update Rate:The update rate for this system is limited by the available RF power for Sense WISP,its energy harvest-ing ef?ciency and RFID protocol(maximum45S/s for Sense WISP),and is5S/s31S/s for this experiment.It will de-crease as the population of Sense WISP increase.The average update rate is15S/s and can be adjusted by changing the sleep time of either Spy WISP and Sense WISP.Spreading high-gain omni-directional antenna can offer better power density in the space,thereby improve the update rate if needed. Acceleration detection:the system is able to detect the move-ment of Sense WISP tagged object.By grasping the tagged objects from table,the system have90%con?dence of de-tecting the movement for15test samples within1m tag-to-reader range.In order to capture those fast movement of tag, like being grasped,the reader have to read Sense Tag with a relatively higher rate than the movement,which is limited by RFID protocol and available RF power near the Sense WISP. For more static tags whose orientation is known to the sys-tem,our system can detect the change of its orientation even at a lower Sense WISP update rate up to1.8m range using single antenna.More antennas in test space will also help. Therefore the platform have distinguished motion detection ability varied by available RF power in the space. APPLICATION AND IMPLEMENTATION

One high-value application of context-awareness(and one of the largest challenges facing science)is the documentation and replication of scienti?c lab experiments.A2012study, for example,showed that47of53key cancer biology results

Figure 4.Localization accuracy in 3D open space:sub-?gures 1?3show results at z =94cm,z =134,z =174cm .The 4ultrasound sources in are placed at the vertices of the 16cm ×14cm cyan squre in the center of the chess plane (20cm/grid,origin at the center).The yellow ball is the ground truth location with sensor’s acutal size (radius =8mm ).The blue ball shows the localization result;size represents standard deviation on each

axis.

Figure 5.Wetlab.We are exploring the use of the localization tags for activity inference in a wetlab

scenario.

Figure 6.Wetlab localization performance:CDF of localization error distribution,in percentage and absolute units.The performance is not signi?cantly different than the freespace case.

could not be replicated,in some cases even with the help of the original researchers [1].Part of what makes documenta-tion and replication dif?cult is the large number and subtlety the many steps performed during a lab experiment.Another factor is that often documentation is performed after the fact since both hands are needed to perform experiment,and lab technicians often wear protective gloves that make writing or typing dif?cult.

Accordingly,we are using a self-documenting smart wet lab as a guiding application of our location system,using a clut-tered lab bench as our deployment environment (Figure 5).We are RFID-tagging key objects in the lab (e.g.:bottles of reagents and glass containners)and tracking their location and motion as experiments https://www.360docs.net/doc/9013788536.html,ing accurate,high-update rate location readings from our tags,we aim to not only infer which speci?c objects are present on the bench,but

when,where and how they are used.With this detailed object location and motion data,coupled with representations of the experimental protocols we hope to be able to infer and docu-ment the objects being used,actions performed on/with them and recognize the experiment being performed.

We implement this system in an (0.8m ×0.5m ×1.2m )lab bench (one table and one shelf above)in the smart wet lab (Figure 5)and attach Sense WISP tag to several bottles of reagents,the system can then infer the current state and ac-tivity of those bottles by measuring its location and move-ment(such as it is on the shelf or in media preparing area)and infer their activity and state.An experiment is designed to report the current static location of 1object,2objects or three objects in 14different locations.The average accuracy can be seen from Figure 6.

Another experiment is conducted to try to recognize a pouring event,when the Sense WISP tagged bottle is pouring into an-other container in order to alarm people if the reagents in the tagged bottle is pouring into the wrong container.Two iden-tical container with the same distance to the tagged bottle are used as the destination of the pouring.During the test,the researcher grasps the tagged bottle from the table and pour-ing its liquid into one of the two containers,which location is known,once any movement activity of the bottle is detected and the bottles orientation is turning to horizontal,the system computes the current location of the bottle while it is pouring.The system then can estimate which container the tagged bot-tle is pouring into by ?nd which container it is mostly close to.Placing the pair of container in 5different places,the system can detect the correct pouring destination container with 90%con?dence for 8times the pouring event for each location.

CONCLUSION AND FUTURE WORK

Using simple RFID infrastructure setting for wireless power and communication,our system is able to estimate the 3D position of a battery-free ultrasound sensor tag with 8cm ac-curacy in an acoustically complex indoor environment.The same tags also provide acceleration sensing.The system is designed to support activity recognition and tracking,by jointly interpreting the data from these sensors.Future work will improve localization performance,scale up the number of sensors with multiple antennas,and test the system’s effec-tiveness in activity recognition applications.

ACKNOWLEDGMENT

This work is funded by Intel Science and Technology Center for Pervasive Computing(ISTC-PC)and NSF award number CNS1305072.REFERENCES

1.Begley,C.,and Ellis,L.Drug development:Raise

standards for preclinical cancer research.Nature483

(2012),531533.

2.Bouet,M.,and Dos Santos,A.L.R?d tags:Positioning

principles and localization techniques.In Wireless Days, 2008.WD’08.1st IFIP,IEEE(2008),1–5.

3.Carter,M.,Stetter,J.,Smith,J.,Parks,A.,Zhao,Y.,

Findlay,M.,and Patel,V.Printed low power

amperometric gas sensors employing rf energy

harvesting.In Meeting Abstracts,no.44,The

Electrochemical Society(2012),1602–1602.

4.Ni,L.M.,Liu,Y.,Lau,Y.C.,and Patil,https://www.360docs.net/doc/9013788536.html,ndmarc:

indoor location sensing using active r?d.Wireless

networks10,6(2004),701–710.

5.Parks,A.N.,Sample,A.P.,Zhao,Y.,and Smith,J.R.A

wireless sensing platform utilizing ambient rf energy.In Biomedical Wireless Technologies,Networks,and

Sensing Systems(BioWireleSS),2013IEEE Topical

Conference on,IEEE(2013),154–156.

6.Priyantha,N.B.,Chakraborty,A.,and Balakrishnan,H.

The cricket location-support system.In Proceedings of the6th annual international conference on Mobile

computing and networking,ACM(2000),32–43.

7.Rahman,M.Z.,and Kleeman,L.Paired measurement

localization:a robust approach for wireless localization.

Mobile Computing,IEEE Transactions on8,8(2009),

1087–1102.

8.Ransford,B.Python client for LLRP-based RFID

readers.https://https://www.360docs.net/doc/9013788536.html,/ransford.

9.Sample,A.P.,Yeager,D.J.,Powledge,P.S.,Mamishev,

A.V.,and Smith,J.R.Design of an r?d-based

battery-free programmable sensing platform.

Instrumentation and Measurement,IEEE Transactions on57,11(2008),2608–2615.

10.Yilmaz,A.,Javed,O.,and Shah,M.Object tracking:A

survey.Acm computing surveys(CSUR)38,4(2006),

13.

11.Zhao,Y.,and Smith,J.R.A battery-free r?d-based

indoor acoustic localization platform.In RFID(RFID), 2013IEEE International Conference on,IEEE(2013),

110–117.

最小二乘法及其应用..

最小二乘法及其应用 1. 引言 最小二乘法在19世纪初发明后,很快得到欧洲一些国家的天文学家和测地学家的广泛关注。据不完全统计,自1805年至1864年的60年间,有关最小二乘法的研究论文达256篇,一些百科全书包括1837年出版的大不列颠百科全书第7版,亦收入有关方法的介绍。同时,误差的分布是“正态”的,也立刻得到天文学家的关注及大量经验的支持。如贝塞尔( F. W. Bessel, 1784—1846)对几百颗星球作了三组观测,并比较了按照正态规律在给定范围内的理论误差值和实际值,对比表明它们非常接近一致。拉普拉斯在1810年也给出了正态规律的一个新的理论推导并写入其《分析概论》中。正态分布作为一种统计模型,在19世纪极为流行,一些学者甚至把19世纪的数理统计学称为正态分布的统治时代。在其影响下,最小二乘法也脱出测量数据意义之外而发展成为一个包罗极大,应用及其广泛的统计模型。到20世纪正态小样本理论充分发展后,高斯研究成果的影响更加显著。最小二乘法不仅是19世纪最重要的统计方法,而且还可以称为数理统计学之灵魂。相关回归分析、方差分析和线性模型理论等数理统计学的几大分支都以最小二乘法为理论基础。正如美国统计学家斯蒂格勒( S. M. Stigler)所说,“最小二乘法之于数理统计学犹如微积分之于数学”。最小二乘法是参数回归的最基本得方法所以研究最小二乘法原理及其应用对于统计的学习有很重要的意义。 2. 最小二乘法 所谓最小二乘法就是:选择参数10,b b ,使得全部观测的残差平方和最小. 用数学公式表示为: 21022)()(m in i i i i i x b b Y Y Y e --=-=∑∑∑∧ 为了说明这个方法,先解释一下最小二乘原理,以一元线性回归方程为例. i i i x B B Y μ++=10 (一元线性回归方程)

数据库死锁问题总结

数据库死锁问题总结 1、死锁(Deadlock) 所谓死锁:是指两个或两个以上的进程在执行过程中,因争夺资源而造 成的一种互相等待的现象,若无外力作用,它们都将无法推进下去。此时称系 统处于死锁状态或系统产生了死锁,这些永远在互相等待的进程称为死锁进程。由于资源占用是互斥的,当某个进程提出申请资源后,使得有关进程在无外力 协助下,永远分配不到必需的资源而无法继续运行,这就产生了一种特殊现象 死锁。一种情形,此时执行程序中两个或多个线程发生永久堵塞(等待),每 个线程都在等待被其他线程占用并堵塞了的资源。例如,如果线程A锁住了记 录1并等待记录2,而线程B锁住了记录2并等待记录1,这样两个线程就发 生了死锁现象。计算机系统中,如果系统的资源分配策略不当,更常见的可能是 程序员写的程序有错误等,则会导致进程因竞争资源不当而产生死锁的现象。 锁有多种实现方式,比如意向锁,共享-排他锁,锁表,树形协议,时间戳协 议等等。锁还有多种粒度,比如可以在表上加锁,也可以在记录上加锁。(回滚 一个,让另一个进程顺利进行) 产生死锁的原因主要是: (1)系统资源不足。 (2)进程运行推进的顺序不合适。 (3)资源分配不当等。 如果系统资源充足,进程的资源请求都能够得到满足,死锁出现的可能 性就很低,否则就会因争夺有限的资源而陷入死锁。其次,进程运行推进顺序 与速度不同,也可能产生死锁。 产生死锁的四个必要条件: (1)互斥条件:一个资源每次只能被一个进程使用。 (2)请求与保持条件:一个进程因请求资源而阻塞时,对已获得的资源保持不放。 破解:静态分配(分配全部资源) (3)不剥夺条件:进程已获得的资源,在末使用完之前,不能强行剥夺。 破解:可剥夺 (4)循环等待条件:若干进程之间形成一种头尾相接的循环等待资源关系。 破解:有序分配 这四个条件是死锁的必要条件,只要系统发生死锁,这些条件必然成立,而只要上述条件之一不满足,就不会发生死锁。 死锁的预防和解除:

我的java基础题和答案详解

If语句相关训练 1. (标识符命名)下面几个变量中,那些是对的那些是错的错的请说明理由(CDF) A. ILoveJava B. $20 C. learn@java D. E. Hello_World F. 2tigers 答:标识符中不能有@,不能含有点号,开头只能是字母和$ 2. (Java 程序的编译与运行)假设有如下程序: package public class HelloWorld{ public static void main(String args[]){ "Hello World"); } } 问: 1)假设这个代码存在文件中,那这个程序能够编译通过为什么 如果编译不通过,应该如何改进 答:不能,含有public的类文件名必须要和类名一致;应将改写成 2)假设这个.java 文件放在C:\javafile\目录下,CLASSPATH=.,则生成的.class 文件应该放在什么目录下如何运行 答:.class应该存放在C:\javafile\目录下 3. (if 语句)读入一个整数,判断其是奇数还是偶数 public class Test { int n; If(n%2==0){ 是偶数”); }else{ 是奇数”); } } 4. (操作符)有如下代码: int a = 5; int b = (a++) + (--a) +(++a); 问执行完之后,b 的结果是多少 答:16 解析a先把5赋值给b让后再自增1相当于(b=5+(--6)+(++5))

5. (基本类型的运算)一家商场在举行打折促销,所有商品都进行8 折优惠。一 位程序员把这个逻辑写成: short price = ...; (操作符)有如下代码: a = (a>b)a:b; 请问这段代码完成了什么功能。 答:这段代码的作用是取最大值,当a>b成立时,a=a;当a>b不成立时,a=b; 8. (if 语句)读入一个整数,表示一个人的年龄。如果小于6 岁,则输出“儿童”,6 岁到13 岁,输出“少儿”;14 岁到18 岁,输出“青少年”;18 岁到35 岁,输出“青年”;35 岁到50 岁,输出“中年”;50 岁以上输出“中老年”。 答:public class AgeTest { public static void main(String[] args) { int n=12; if(n<6){

matlab常用对象操作

、常用对象操作:除了一般windows窗口的常用功能键外。 1、!dir 可以查看当前工作目录的文件。!dir& 可以在dos状态下查看。 2、who 可以查看当前工作空间变量名, whos 可以查看变量名细节。 3、功能键: 功能键快捷键说明 方向上键Ctrl+P 返回前一行输入 方向下键Ctrl+N 返回下一行输入 方向左键Ctrl+B 光标向后移一个字符 方向右键Ctrl+F 光标向前移一个字符 Ctrl+方向右键 Ctrl+R 光标向右移一个字符 Ctrl+方向左键 Ctrl+L 光标向左移一个字符 home Ctrl+A 光标移到行首 End Ctrl+E 光标移到行尾 Esc Ctrl+U 清除一行 Del Ctrl+D 清除光标所在的字符 Backspace Ctrl+H 删除光标前一个字符 Ctrl+K 删除到行尾 Ctrl+C 中断正在执行的命令 4、clc可以命令窗口显示的内容,但并不清除工作空间。 二、函数及运算 1、运算符: +:加,-:减, *:乘, /:除,\:左除 ^:幂,':复数的共轭转置,():制定运算顺序。 2、常用函数表: sin( ) 正弦(变量为弧度) Cot( ) 余切(变量为弧度) sind( ) 正弦(变量为度数) Cotd( ) 余切(变量为度数) asin( ) 反正弦(返回弧度) acot( ) 反余切(返回弧度) Asind( ) 反正弦(返回度数) acotd( ) 反余切(返回度数) cos( ) 余弦(变量为弧度) exp( ) 指数 cosd( ) 余弦(变量为度数) log( ) 对数 acos( ) 余正弦(返回弧度) log10( ) 以10为底对数 acosd( ) 余正弦(返回度数) sqrt( ) 开方 tan( ) 正切(变量为弧度) realsqrt( ) 返回非负根 tand( ) 正切(变量为度数) abs( ) 取绝对值

1、曲线拟合及其应用综述

曲线拟合及其应用综述 摘要:本文首先分析了曲线拟合方法的背景及在各个领域中的应用,然后详细介绍了曲线拟合方法的基本原理及实现方法,并结合一个具体实例,分析了曲线拟合方法在柴油机故障诊断中的应用,最后对全文内容进行了总结,并对曲线拟合方法的发展进行了思考和展望。 关键词:曲线拟合最小二乘法故障模式识别柴油机故障诊断 1背景及应用 在科学技术的许多领域中,常常需要根据实际测试所得到的一系列数据,求出它们的函数关系。理论上讲,可以根据插值原则构造n 次多项式Pn(x),使得Pn(x)在各测试点的数据正好通过实测点。可是, 在一般情况下,我们为了尽量反映实际情况而采集了很多样点,造成了插值多项式Pn(x)的次数很高,这不仅增大了计算量,而且影响了函数的逼近程度;再就是由于插值多项式经过每一实测样点,这样就会保留测量误差,从而影响逼近函数的精度,不易反映实际的函数关系。因此,我们一般根据已知实际测试样点,找出被测试量之间的函数关系,使得找出的近似函数曲线能够充分反映实际测试量之间的关系,这就是曲线拟合。 曲线拟合技术在图像处理、逆向工程、计算机辅助设计以及测试数据的处理显示及故障模式诊断等领域中都得到了广泛的应用。 2 基本原理 2.1 曲线拟合的定义 解决曲线拟合问题常用的方法有很多,总体上可以分为两大类:一类是有理论模型的曲线拟合,也就是由与数据的背景资料规律相适应的解析表达式约束的曲线拟合;另一类是无理论模型的曲线拟合,也就是由几何方法或神经网络的拓扑结构确定数据关系的曲线拟合。 2.2 曲线拟合的方法 解决曲线拟合问题常用的方法有很多,总体上可以分为两大类:一类是有理论模型的曲线拟合,也就是由与数据的背景资料规律相适应的解析表达式约束的曲线拟合;另一类是无理论模型的曲线拟合,也就是由几何方法或神经网络的拓扑结构确定数据关系的曲线拟合。 2.2.1 有理论模型的曲线拟合 有理论模型的曲线拟合适用于处理有一定背景资料、规律性较强的拟合问题。通过实验或者观测得到的数据对(x i,y i)(i=1,2, …,n),可以用与背景资料规律相适应的解析表达式y=f(x,c)来反映x、y之间的依赖关系,y=f(x,c)称为拟合的理论模型,式中c=c0,c1,…c n是待定参数。当c在f中线性出现时,称为线性模型,否则称为非线性模型。有许多衡量拟合优度的标准,最常用的方法是最小二乘法。 2.2.1.1 线性模型的曲线拟合 线性模型中与背景资料相适应的解析表达式为: ε β β+ + =x y 1 (1) 式中,β0,β1未知参数,ε服从N(0,σ2)。 将n个实验点分别带入表达式(1)得到: i i i x yε β β+ + = 1 (2) 式中i=1,2,…n,ε1, ε2,…, εn相互独立并且服从N(0,σ2)。 根据最小二乘原理,拟合得到的参数应使曲线与试验点之间的误差的平方和达到最小,也就是使如下的目标函数达到最小: 2 1 1 ) ( i i n i i x y Jε β β- - - =∑ = (3) 将试验点数据点入之后,求目标函数的最大值问题就变成了求取使目标函数对待求参数的偏导数为零时的参数值问题,即: ) ( 2 1 1 = - - - - = ? ?∑ = i i n i i x y J ε β β β (4)

死锁问题解决方法

Sqlcode -244 死锁问题解决 版本说明 事件日期作者说明 创建09年4月16日Alan 创建文档 一、分析产生死锁的原因 这个问题通常是因为锁表产生的。要么是多个用户同时访问数据库导致该问题,要么是因为某个进程死了以后资源未释放导致的。 如果是前一种情况,可以考虑将数据库表的锁级别改为行锁,来减少撞锁的机会;或在应用程序中,用set lock mode wait 3这样的语句,在撞锁后等待若干秒重试。 如果是后一种情况,可以在数据库端用onstat -g ses/onstat -g sql/onstat -k等命令找出锁表的进程,用onmode -z命令结束进程;如果不行,就需要重新启动数据库来释放资源。 二、方法一 onmode -u 将数据库服务器强行进入单用户模式,来释放被锁的表。注意:生产环境不适合。 三、方法二 1、onstat -k |grep HDR+X 说明:HDR+X为排他锁,HDR 头,X 互斥。返回信息里面的owner项是正持有锁的线程的共享内存地址。 2、onstat -u |grep c60a363c 说明:c60a363c为1中查到的owner内容。sessid是会话标识符编号。 3、onstat -g ses 20287 说明:20287为2中查到的sessid内容。Pid为与此会话的前端关联的进程标识符。 4、onstat -g sql 20287

说明:20287为2中查到的sessid内容。通过上面的命令可以查看执行的sql语句。 5、ps -ef |grep 409918 说明:409918为4中查到的pid内容。由此,我们可以得到锁表的进程。可以根据锁表进程的重要程度采取相应的处理方法。对于重要且该进程可以自动重联数据库的进程,可以用onmode -z sessid的方法杀掉锁表session。否则也可以直接杀掉锁表的进程 kill -9 pid。 四、避免锁表频繁发生的方法 4.1将页锁改为行锁 1、执行下面sql语句可以查询当前库中所有为页锁的表名: select tabname from systables where locklevel='P' and tabid > 99 2、执行下面语句将页锁改为行锁 alter table tabname lock mode(row) 4.2统计更新 UPDATE STATISTICS; 4.3修改数据库配置onconfig OPTCOMPIND参数帮助优化程序为应用选择合适的访问方法。 ?如果OPTCOMPIND等于0,优化程序给予现存索引优先权,即使在表扫描比较快时。 ?如果OPTCOMPIND设置为1,给定查询的隔离级设置为Repeatable Read时,优化程序才使用索引。 ?如果OPTCOMPIND等于2,优化程序选择基于开销选择查询方式。,即使表扫描可以临时锁定整个表。 *建议设置:OPTCOMPIND 0 # To hint the optimizer 五、起停informix数据库 停掉informix数据库 onmode -ky 启动informix数据库 oninit 注意千万别加-i参数,这样会初始化表空间,造成数据完全丢失且无法挽回。

精选30道Java笔试题解答

都是一些非常非常基础的题,是我最近参加各大IT公司笔试后靠记忆记下来的,经过整理献给与我一样参加各大IT校园招聘的同学们,纯考Java基础功底,老手们就不用进来了,免得笑话我们这些未出校门的孩纸们,但是IT公司就喜欢考这些基础的东西,所以为了能进大公司就~~~当复习期末考吧。花了不少时间整理,在整理过程中也学到了很多东西,请大家认真对待每一题~~~ 下面都是我自己的答案非官方,仅供参考,如果有疑问或错误请一定要提出来,大家一起进步啦~~~ 1. 下面哪些是Thread类的方法() A start() B run() C exit() D getPriority() 答案:ABD 解析:看Java API docs吧:https://www.360docs.net/doc/9013788536.html,/javase/7/docs/api/,exit()是System类的方法,如System.exit(0)。 2. 下面关于https://www.360docs.net/doc/9013788536.html,ng.Exception类的说法正确的是() A 继承自Throwable B Serialable CD 不记得,反正不正确 答案:A 解析:Java异常的基类为https://www.360docs.net/doc/9013788536.html,ng.Throwable,https://www.360docs.net/doc/9013788536.html,ng.Error和https://www.360docs.net/doc/9013788536.html,ng.Exception继承Throwable,RuntimeException和其它的Exception等继承Exception,具体的RuntimeException继承RuntimeException。扩展:错误和异常的区别(Error vs Exception) 1) https://www.360docs.net/doc/9013788536.html,ng.Error: Throwable的子类,用于标记严重错误。合理的应用程序不应该去try/catch这种错误。绝大多数的错误都是非正常的,就根本不该出现的。 https://www.360docs.net/doc/9013788536.html,ng.Exception: Throwable的子类,用于指示一种合理的程序想去catch的条件。即它仅仅是一种程序运行条件,而非严重错误,并且鼓励用户程序去catch它。 2) Error和RuntimeException及其子类都是未检查的异常(unchecked exceptions),而所有其他的Exception 类都是检查了的异常(checked exceptions). checked exceptions: 通常是从一个可以恢复的程序中抛出来的,并且最好能够从这种异常中使用程序恢复。比如FileNotFoundException, ParseException等。 unchecked exceptions: 通常是如果一切正常的话本不该发生的异常,但是的确发生了。比如ArrayIndexOutOfBoundException, ClassCastException等。从语言本身的角度讲,程序不该去catch这类异常,虽然能够从诸如RuntimeException这样的异常中catch并恢复,但是并不鼓励终端程序员这么做,因为完全没要必要。因为这类错误本身就是bug,应该被修复,出现此类错误时程序就应该立即停止执行。因此, 面对Errors和unchecked exceptions应该让程序自动终止执行,程序员不该做诸如try/catch这样的事情,而是应该查明原因,修改代码逻辑。 RuntimeException:RuntimeException体系包括错误的类型转换、数组越界访问和试图访问空指针等等。

最小二乘法原理及应用【文献综述】

毕业论文文献综述 信息与计算科学 最小二乘法的原理及应用 一、国内外状况 国际统计学会第56届大会于2007年8月22-29日在美丽的大西洋海滨城市、葡萄牙首都里斯本如期召开。应大会组委会的邀请,以会长李德水为团长的中国统计学会代表团一行29人注册参加了这次大会。北京市统计学会、山东省统计学会,分别组团参加了这次大会。中国统计界(不含港澳台地区)共有58名代表参加了这次盛会。本届大会的特邀论文会议共涉及94个主题,每个主题一般至少有3-5位代表做学术演讲和讨论。通过对大会论文按研究内容进行归纳,特邀论文大致可以分为四类:即数理统计,经济、社会统计和官方统计,统计教育和统计应用。 数理统计方面。数理统计作为统计科学的一个重要部分,特别是随机过程和回归分析依然展现着古老理论的活力,一直受到统计界的重视并吸引着众多的研究者。本届大会也不例外。 二、进展情况 数理统计学19世纪的数理统计学史, 就是最小二乘法向各个应用领域拓展的历史席卷了统计大部分应用的几个分支——相关回归分析, 方差分析和线性模型理论等, 其灵魂都在于最小二乘法; 不少近代的统计学研究是在此法的基础上衍生出来, 作为其进一步发展或纠正其不足之处而采取的对策, 这包括回归分析中一系列修正最小二乘法而导致的估计方法。 数理统计学的发展大致可分 3 个时期。① 20 世纪以前。这个时期又可分成两段,大致上可以把高斯和勒让德关于最小二乘法用于观测数据的误差分析的工作作为分界线,前段属萌芽时期,基本上没有超出描述性统计量的范围。后一阶段可算作是数理统计学的幼年阶段。首先,强调了推断的地位,而摆脱了单纯描述的性质。由于高斯等的工作揭示了最小二乘法的重要性,学者们普遍认为,在实际问题中遇见的几乎所有的连续变量,都可以满意地用最小二乘法来刻画。这种观点使关于最小二乘法得到了深入的发展,②20世纪初到第二次世界大战结束。这是数理统计学蓬勃发展达到成熟的时期。许多重要的基本观点和方法,以及数理统计学的主要分支学科,都是在这个时期建立和发展起来的。这个时期的成就,包含了至今仍在广泛使用的大多数统计方法。在其发展中,以英国统计学家、生物学家费希尔为代表的英国学派起了主导作用。③战后时期。这一时期中,数理统计学在应用和理论两方面继续获得很大的进展。

【VIP专享】Java中String类的方法详解

Java中String类的方法详解 JJava中String 类的方法及说明 String : 字符串类型 一、构造函数 String(byte[ ]bytes ):通过byte数组构造字符串对象。 String(char[ ]value ):通过char数组构造字符串对象。 String(Sting original ):构造一个original的副本。即:拷贝一个original。 String(StringBuffer buffer ):通过StringBuffer数组构造字符串对象。例如: byte[] b = {'a','b','c','d','e','f','g','h','i','j'}; char[] c = {'0','1','2','3','4','5','6','7','8','9'}; String sb = new String(b); //abcdefghij String sb_sub = new String(b,3/*offset*/,2/*length*/); //de String sc = new String(c); //0123456789 String sc_sub = new String(c,3,2); //34 String sb_copy = new String(sb); //abcdefghij System.out.println("sb:"+sb); System.out.println("sb_sub:"+sb_sub); System.out.println("sc:"+sc); System.out.println("sc_sub:"+sc_sub); System.out.println("sb_copy:"+sb_copy); 输出结果:sb:abcdefghij sb_sub:de sc:0123456789 sc_sub:34 sb_copy:abcdefghij 二、方法: 说明:①、所有方法均为public。 ②、书写格式: [修饰符] <返回类型><方法名([参数列表])> 0.public static int parseInt(String s) public static byte parseByte(String s) public static boolean parseBoolean(String s) public static short parseShort(String s) public static long parseLong(String s) public static double parseDouble(String s) 例如:可以将“数字”格式的字符串,转化为相应的基本数据类型 int i=Integer.pareInt(“123”)

最小二乘法综述及举例

最小二乘法综述及算例 一最小二乘法的历史简介 1801年,意大利天文学家朱赛普·皮亚齐发现了第一颗小行星谷神星。经过40天的跟踪观测后,由于谷神星运行至太阳背后,使得皮亚齐失去了谷神星的位置。随后全世界的科学家利用皮亚齐的观测数据开始寻找谷神星,但是根据大多数人计算的结果来寻找谷神星都没有结果。时年24岁的高斯也计算了谷神星的轨道。奥地利天文学家海因里希·奥尔伯斯根据高斯计算出来的轨道重新发现了谷神星。 高斯使用的最小二乘法的方法发表于1809年他的著作《天体运动论》中。 经过两百余年后,最小二乘法已广泛应用与科学实验和工程技术中,随着现代电子计算机的普及与发展,这个方法更加显示出其强大的生命力。 二最小二乘法原理 最小二乘法的基本原理是:成对等精度测得的一组数据),...,2,1(,n i y x i i =,是找出一条最佳的拟合曲线,似的这条曲线上的个点的值与测量值的差的平方和在所有拟合曲线中最小。 设物理量y 与1个变量l x x x ,...,2,1间的依赖关系式为:)(,...,1,0;,...,2,1n l a a a x x x f y =。 其中n a a a ,...,1,0是n +l 个待定参数,记()2 1 ∑=- = m i i i y v s 其中 是测量值, 是由己求 得的n a a a ,...,1,0以及实验点),...,2,1)(,...,(;,2,1m i v x x x i il i i =得出的函数值 )(,...,1,0;,...,2,1n il i i a a a x x x f y =。 在设计实验时, 为了减小误差, 常进行多点测量, 使方程式个数大于待定参数的个数, 此时构成的方程组称为矛盾方程组。通过最小二乘法转化后的方程组称为正规方程组(此时方程式的个数与待定参数的个数相等) 。我们可以通过正规方程组求出a 最小二乘法又称曲线拟合, 所谓“ 拟合” 即不要求所作的曲线完全通过所有的数据点, 只要求所得的曲线能反映数据的基本趋势。 三曲线拟合 曲线拟合的几何解释: 求一条曲线, 使数据点均在离此曲线的上方或下方不远处。 (1)一元线性拟合 设变量y 与x 成线性关系x a a y 10+=,先已知m 个实验点),...,2,1(,m i v x i i =,求两个未知参数1,0a a 。 令()2 1 10∑ =--=m i i i x a a y s ,则1,0a a 应满足1,0,0==??i a s i 。 即 i v i v

《操作系统原理》5资源管理(死锁)习题

第五章死锁练习题 (一)单项选择题 1.系统出现死锁的根本原因是( )。 A.作业调度不当B.系统中进程太多C.资源的独占性D.资源管理和进程推进顺序都不得当 2.死锁的防止是根据( )采取措施实现的。 A.配置足够的系统资源B.使进程的推进顺序合理 C.破坏产生死锁的四个必要条件之一D.防止系统进入不安全状态 3.采用按序分配资源的策略可以防止死锁.这是利用了使( )条件不成立。 A.互斥使用资源B循环等待资源C.不可抢夺资源D.占有并等待资源 4.可抢夺的资源分配策略可预防死锁,但它只适用于( )。 A.打印机B.磁带机C.绘图仪D.主存空间和处理器 5.进程调度算法中的( )属于抢夺式的分配处理器的策略。 A.时间片轮转算法B.非抢占式优先数算法C.先来先服务算法D.分级调度算法 6.用银行家算法避免死锁时,检测到( )时才分配资源。 A.进程首次申请资源时对资源的最大需求量超过系统现存的资源量 B.进程己占用的资源数与本次申请资源数之和超过对资源的最大需求量 C.进程已占用的资源数与本次申请的资源数之和不超过对资源的最大需求量,且现存资源能满足尚需的最大资源量 D进程已占用的资源数与本次申请的资源数之和不超过对资源的最大需求量,且现存资源能满足本次申请量,但不能满足尚需的最大资源量 7.实际的操作系统要兼顾资源的使用效率和安全可靠,对资源的分配策略,往往采用( )策略。 A死锁的防止B.死锁的避免C.死锁的检测D.死锁的防止、避免和检测的混合 (二)填空题 1.若系统中存在一种进程,它们中的每一个进程都占有了某种资源而又都在等待其中另一个进程所占用的资源。这种等待永远不能结束,则说明出现了______。 2.如果操作系统对______或没有顾及进程______可能出现的情况,则就可能形成死锁。 3.系统出现死锁的四个必要条件是:互斥使用资源,______,不可抢夺资源和______。 4.如果进程申请一个某类资源时,可以把该类资源中的任意一个空闲资源分配给进程,则说该类资源中的所有资源是______。 5.如果资源分配图中无环路,则系统中______发生。 6.为了防止死锁的发生,只要采用分配策略使四个必要条件中的______。 7.使占有并等待资源的条件不成立而防止死锁常用两种方法:______和______. 8静态分配资源也称______,要求每—个进程在______就申请它需要的全部资源。 9.释放已占资源的分配策略是仅当进程______时才允许它去申请资源。 10.抢夺式分配资源约定,如果一个进程已经占有了某些资源又要申请新资源,而新资源不能满足必须等待时、系统可以______该进程已占有的资源。 11.目前抢夺式的分配策略只适用于______和______。 12.对资源采用______的策略可以使循环等待资源的条件不成立。 13.如果操作系统能保证所有的进程在有限的时间内得到需要的全部资源,则称系统处于______。14.只要能保持系统处于安全状态就可______的发生。 15.______是一种古典的安全状态测试方法。 16.要实现______,只要当进程提出资源申请时,系统动态测试资源分配情况,仅当能确保系统安全时才把资源分配给进程。

C++ string 详解

C++ string 详解 之所以抛弃char*的字符串而选用C++标准程序库中的string类,是因为他和前者比较起来,不必担心内存是否足够、字符串长度等等,而且作为一个类出现,他集成的操作函数足以完成我们大多数情况下(甚至是100%)的需要。我们可以用= 进行赋值操作,== 进行比较,+ 做串联(是不是很简单?)。我们尽可以把它看成是C++的基本数据类型。 好了,进入正题……… 首先,为了在我们的程序中使用string类型,我们必须包含头文件。如下: #include //注意这里不是string.h string.h是C字符串头文件 1.声明一个C++字符串 声明一个字符串变量很简单: string Str; 这样我们就声明了一个字符串变量,但既然是一个类,就有构造函数和析构函数。上面的声明没有传入参数,所以就直接使用了string的默认的构造函数,这个函数所作的就是把Str 初始化为一个空字符串。String类的构造函数和析构函数如下: a) string s; //生成一个空字符串s b) string s(str) //拷贝构造函数生成str的复制品 c) string s(str,stridx) //将字符串str内“始于位置stridx”的部分当作字符串的初值 d) string s(str,stridx,strlen) //将字符串str内“始于stridx且长度顶多strlen”的部分作为字符串的初值 e) string s(cstr) //将C字符串作为s的初值 f) string s(chars,chars_len) //将C字符串前chars_len个字符作为字符串s的初值。 g) string s(num,c) //生成一个字符串,包含num个c字符 h) string s(beg,end) //以区间beg;end(不包含end)内的字符作为字符串s的初值 i) s.~string() //销毁所有字符,释放内存 都很简单,我就不解释了。 2.字符串操作函数 这里是C++字符串的重点,我先把各种操作函数罗列出来,不喜欢把所有函数都看完的人可以在这里找自己喜欢的函数,再到后面看他的详细解释。

Application对象基本操作应用示例

Application对象基本操作应用示例 Application对象代表整个Microsoft Excel应用程序,带有175个属性和52个方法,可以设置整个应用程序的环境或配置应用程序。 示例01-01:体验开/关屏幕更新(ScreenUpdating属性) Sub 关闭屏幕更新() MsgBox "顺序切换工作表Sheet1→Sheet2→Sheet3→Sheet2,先开启屏幕更新,然后关闭屏幕更新" Worksheets(1).Select MsgBox "目前屏幕中显示工作表Sheet1" Application.ScreenUpdating = True Worksheets(2).Select MsgBox "显示Sheet2了吗?" Worksheets(3).Select MsgBox "显示Sheet3了吗?" Worksheets(2).Select MsgBox "下面与前面执行的程序代码相同,但关闭屏幕更新功能" Worksheets(1).Select MsgBox "目前屏幕中显示工作表Sheet1" & Chr(10) & "关屏屏幕更新功能" Application.ScreenUpdating = False Worksheets(2).Select MsgBox "显示Sheet2了吗?" Worksheets(3).Select MsgBox "显示Sheet3了吗?" Worksheets(2).Select Application.ScreenUpdating = True End Sub 示例说明:ScreenUpdating属性用来控制屏幕更新。当运行一个宏程序处理涉及到多个工作表或单元格中的大量数据时,若没有关闭屏幕更新,则会占用CPU的处理时间,从而降低程序的运行速度,而关闭该属性则可显著提高程序运行速度。 示例01-02:使用状态栏(StatusBar属性) Sub testStatusBar() Application.DisplayStatusBar = True '开启状态栏显示 '赋值状态栏显示的文本 Application.StatusBar = "https://www.360docs.net/doc/9013788536.html," End Sub 示例说明:StatusBar属性用来指定显示在状态栏上的信息。若不想再显示状态栏文本,可使用Applicat ion.StatusBar = False语句关闭状态栏显示,也可以在程序开始将原先的状态栏设置存储,如使用语句o ldStatusBar = Application.DisplayStatusBar将状态栏原来的信息存储在变量oldStatusBar,在程序运行完成或退出时,将变量重新赋值给状态栏,如使用语句Application.DisplayStatusBar = oldStatusBa r,以恢复状态栏原状。

操作系统死锁练习及答案

死锁练习题 (一)单项选择题 l系统出现死锁的根本原因是( )。 A.作业调度不当 B.系统中进程太多 C.资源的独占性 D.资源管理和进程推进顺序都不得当 2.死锁的防止是根据( )采取措施实现的。 A.配置足够的系统资源 B.使进程的推进顺序合理 C.破坏产生死锁的四个必要条件之一 D.防止系统进入不安全状态 3.采用按序分配资源的策略可以防止死锁.这是利用了使( )条件不成立。 A.互斥使用资源 B循环等待资源 c.不可抢夺资源 D.占有并等待资源 4.可抢夺的资源分配策略可预防死锁,但它只适用于( )。A.打印机 B.磁带机 c.绘图仪 D.主存空间和处理器 5.进程调度算法中的( )属于抢夺式的分配处理器的策略。A.时间片轮转算法 B.非抢占式优先数算法 c.先来先服务算法 D.分级调度算法 6.用银行家算法避免死锁时,检测到( )时才分配资源。 A.进程首次申请资源时对资源的最大需求量超过系统现存的资源量 B.进程己占用的资源数与本次申请资源数之和超过对资源的最大需求量 c.进程已占用的资源数与本次申请的资源数之和不超过对资源的最大需求量,且现存资源能满足尚需的最大资源量 D进程已占用的资源数与本次申请的资源数之和不超过对资源的最大需求量,且现存资源能满足本次申请量,但不能满足尚需的最大资源量 7.实际的操作系统要兼顾资源的使用效率和安全可靠,对资源的分配策略,往往采用 ( )策略。 A死锁的防止 B.死锁的避免 c.死锁的检测 D.死锁的防止、避免和检测的混合(一)单项选择题 1.D 2.C 3.B 4.D 5.A 6 C 7 D (二)填空题 l若系统中存在一种进程,它们中的每一个进程都占有了某种资源而又都在等待其中另一个进程所占用的资源。这种等待永远不能结束,则说明出现了______。 2.如果操作系统对 ______或没有顾及进程______可能出现的情况,则就可能形成死锁。3.系统出现死锁的四个必要条件是:互斥使用资源,______,不可抢夺资源和______。 4.如果进程申请一个某类资源时,可以把该类资源中的任意一个空闲资源分配给进程,则说该类资源中的所有资源是______。 5.如果资源分配图中无环路,则系统中______发生。 6.为了防止死锁的发生,只要采用分配策略使四个必要条件中的______。 7.使占有并等待资源的条件不成立而防止死锁常用两种方法:______和______. 8静态分配资源也称______,要求每—个进程在______就申请它需要的全部资源。 9.释放已占资源的分配策略是仅当进程______时才允许它去申请资源。 10抢夺式分配资源约定,如果一个进程已经占有了某些资源又要申请新资源,而新资源不能满足必须等待时、系统可以______该进程已占有的资源。 11.目前抢夺式的分配策略只适用于______和______。 12.对资源采用______的策略可以使循环等待资源的条件不成立。 13.如果操作系统能保证所有的进程在有限的时间内得到需要的全部资源,则称系统处于______。 14.只要能保持系统处于安全状态就可______的发生。 15.______是一种古典的安全状态测试方法。 16.要实现______,只要当进程提出资源申请时,系统动态测试资源分配情况,仅当能确保系统安全时才把资源分配给进程。 17.可以证明,M个同类资源被n个进程共享时,只要不等式______成立,则系统一定不会发生死锁,其中x为每个进程申请该类资源的最大量。 18.______对资源的分配不加限制,只要有剩余的资源,就可把资源分配给申请者。 19.死锁检测方法要解决两个问题,一是______是否出现了死锁,二是当有死锁发生时怎样去______。 20.对每个资源类中只有一个资源的死锁检测程序根据______和______两张表中记录的资源情况,把进程等待资源的关系在矩阵中表示出

C++ string

C++ string介绍 char*的字符串和C++标准程序库中的string类相比,后者不必担心内存是否足够、字符串长度等等,而且作为一个类出现,他集成的操作函数足以完成我们大多数情况下(甚至是100%)的需要。我们可以用 = 进行赋值操作,== 进行比较,+ 做串联(是不是很简单?)。我们尽可以把它看成是C++的基本数据类型。 好了,进入正题………- 首先,为了在我们的程序中使用string类型,我们必须包含头文件。如下: #include //注意这里不是string.h string.h是C字符串头文件 1.声明一个C++字符串 声明一个字符串变量很简单: string Str; 这样我们就声明了一个字符串变量,但既然是一个类,就有构造函数和析构函数。上面的声明没有传入参数,所以就直接使用了string的默认的构造函数,这个函数所作的就是把Str初始化为一个空字符串。String类的构造函数和析构函数如下: a) string s; //生成一个空字符串s b) string s(str) //拷贝构造函数生成str的复制品 c) string s(str,stridx) //将字符串str内“始于位置stridx”的部分当作字符串的初值 d) string s(str,stridx,strlen) //将字符串str内“始于stridx且长度顶多strlen”的部分作为字符串的初值 e) string s(cstr) //将C字符串作为s的初值 f) string s(chars,chars_len) //将C字符串前chars_len个字符作为字符串s的初值。 g) string s(num,c) //生成一个字符串,包含num个c字符 h) string s(beg,end) //以区间beg;end(不包含end)内的字符作为字符串s的初值 i) s.~string() //销毁所有字符,释放内存 都很简单,我就不解释了。 2.字符串操作函数 这里是C++字符串的重点,我先把各种操作函数罗列出来,不喜欢把所有函数都看完的人可以在这里找自己喜欢的函数,再到后面看他的详细解释。 a) =,assign() //赋以新值

最小二乘法在误差分析中的应用

误差理论综述与最小二乘法讨论 摘要:本文对误差理论和有关数据处理的方法进行综述。并且针对最小二乘法(LS)的创立、发展、思想方法等相关方面进行了研究和总结。同时,将近年发展起来的全面最小二乘法(TLS)同传统最小二乘法进行了对比。 1.误差的有关概念 对科学而言,各种物理量都需要经过测量才能得出结果。许多物理量的发现,物理常数的确定,都是通过精密测量得到的。任何测试结果,都含有误差,因此,必须研究,估计和判断测量结果是否可靠,给出正确评定。对测量结果的分析、研究、判断,必须采用误差理论,它是我们客观分析的有力工具 测量基本概念 一个物理量的测量值应由数值和单位两部分组成。按实验数据处理的方式,测量可分为直接测量、间接测量和组合测量。 直接测量:可以用测量仪表直接读出测量值的测量。 间接测量:有些物理量无法直接测得,需要依据待测物理量与若干直接测量量的函数关系求出。 组合测量:如有若干个待求量,把这些待求量用不同方法组合起来进行测量,并把测量结果与待求量之间的函数关系列成方程组,用最小二乘法求出这个待求量的数值,即为组合测量。 误差基本概念 误差是评定测量精度的尺度,误差越小表示精度越高。若某物理量的测量值为y,真值为Y,则测量误差dy=y-Y。虽然真值是客观存在的,但实际应用时它一般无从得知。按照误差的性质,可分为随机误差,系统误差和粗大误差三类。 随机误差:是同一测量条件下,重复测量中以不可预知方式变化的测量误差分量。 系统误差:是同一测量条件下,重复测量中保持恒定或以可预知方式变化的测量误差分量。 粗大误差:指超出在规定条件下预期的误差。 等精度测量的随机误差 当对同一量值进行多次等精度的重复测量,得到一系列的测量值,每个测量

死锁问题的相关研究

死锁问题的相关研究 摘要死锁是计算机操作系统学习中的一个重点,进程在使用系统资源时易产生死锁问题,若何排除、预防和避免死锁,是我们所要研究的重要问题。 关键词银行家算法;存储转发;重装死锁 所谓死锁是指两个或两个以上的进程在执行过程中,因争夺资源而造成的一种互相等待的现象,若无外力作用,它们都将无法推进下去.此时称系统处于死锁状态或系统产生了死锁,这些永远在互相等待的进程称为死锁进程。 1产生死锁的原因及其必要条件 1)产生死锁的原因。因为系统资源不足;进程运行推进的顺序不合适;资源分配不当等。如果系统资源充足,进程的资源请求都能够得到满足,死锁出现的可能性就很低,否则就会因争夺有限的资源而陷入死锁。其次,进程运行推进顺序与速度不同,也可能产生死锁。 2)产生死锁的四个必要条件。互斥条件:一个资源每次只能被一个进程使用。请求与保持条件(占有等待):一个进程因请求资源而阻塞时,对已获得的资源保持不放。不剥夺条件(不可抢占):进程已获得的资源,在未使用完之前,不能强行剥夺。循环等待条件:若干进程之间形成一种头尾相接的循环等待资源关系。 这四个条件是死锁的必要条件,只要系统发生死锁,这些条件必然成立,而只要上述条件之一不满足,就不会发生死锁。 2死锁的解除与预防 理解了死锁的原因,尤其是产生死锁的四个必要条件,就可以最大可能地避免、预防和解除死锁。在系统设计、进程调度等方面注意如何不让这四个必要条件成立,如何确定资源的合理分配算法,避免进程永久占据系统资源。 1)有序资源分配法。这种算法资源按某种规则系统中的所有资源统一编号(例如打印机为1、磁带机为2、磁盘为3、等等),申请时必须以上升的次序。 采用有序资源分配法:R1的编号为1,R2的编号为2;PA:申请次序应是:R1,R2;PB:申请次序应是:R1,R2;这样就破坏了环路条件,避免了死锁的发生。 2)银行算法。避免死锁算法中最有代表性的算法是DijkstraE.W于1968年提出的银行家算法。该算法需要检查申请者对资源的最大需求量,如果系统现存的各类资源可以满足申请者的请求,就满足申请者的请求。这样申请者就可很快

相关文档
最新文档