计算机科学与技术专业外文翻译--插值与拟合

合集下载

《计算机专业英语》(中英文对照)

《计算机专业英语》(中英文对照)
UNIVAC (Universal Automatic Computer) 通用自动计算机
计算机专业英语
1-4
Chapter 1 The History and Future of Computers
1.1 The Invention of the Computer
It is hard to say exactly when the modern computer was invented. Starting in the 1930s and through the 1940s, a number of machines were developed that were like computers. But most of these machines did not have all the characteristics that we associate with computers today. These characteristics are that the machine is electronic, that it has a stored program, and that it is general purpose.
计算机专业英语 Computer English
Chapter 1 The History and Future of Computers 2009.9.1
Chapter 1 The History and Future of Computers
Key points: useful terms and definitions of
在 EDVAC 完 成 之 前 , 其 他 一 些 机 器 建 成 了 , 它 们 吸 收 了 Eckert 、 Mauchly和Neuman设计的要素。其中一部是在英国剑桥研制的电子延迟 存储自动计算机,或简称EDSAC,它在1949年5月首次运行,它可能是世 界的第一台电子储存程序、通用型计算机投入运行。在美国运行的第一 部计算机是二进制自动计算机,或简称BINAC,它在1949年8月投入运行。

计算机科学与技术专业课程英译

计算机科学与技术专业课程英译

1 计算机导论Intorduction of Computer2 高等数学Avanced Mathematics3 线性代数Linear Alberia4 离散数学Discrete Mathematics5 数值分析Numerical value Analysis6 大学英语Colleage English7 模拟电子电路Analog Electronic Circuit8 数字电子电路Digital Electronic Circuit9 软件工程Software Engineering10 信号与系统Signal and System11 多媒体技术Multimedia Technology12 操作系统Operation System13 数据结构Data Structure14 编译原理Principle of Compiling15 数据库原理Principle of Database16 信号与系统Signal and System17 计算机组成原理Constitution Principle of Computer18 计算机网络Cyber networks19 计算机图形学Cyber graphics20 人工智能Artificial Intelligence21 C++语言程序设计C++ Program Design22J AVA语言程序设计Java Program Design23 ASP编程基础及应用ASP Programming Base and Application24 LINUX操作系统应用与开发Linux Operation System Application and Development25 微机原理Principle of Micro computer资源与环境经济学Economics of Natural Resources and The Environment劳动经济学Labor Economics经济学名著选读Selected Reading of the Masterpieces of Economics社会主义经济理论Socialist Economic Theory国际银行学International Banking城市经济学Urban Economics精益管理Lean Management管理学Management计算机外设原理与维修Computer Peripheral。

数值计算方法插值与拟合

数值计算方法插值与拟合

数值计算方法插值与拟合数值计算方法在科学计算和工程应用中起着重要的作用,其中插值和拟合是其中两个常用的技术。

插值是指通过已知的离散数据点来构造出连续函数或曲线的过程,拟合则是找到逼近已知数据的函数或曲线。

本文将介绍插值和拟合的基本概念和常见的方法。

一、插值和拟合的基本概念插值和拟合都是通过已知数据点来近似表达未知数据的方法,主要区别在于插值要求通过已知数据点的函数必须经过这些数据点,而拟合则只要求逼近这些数据点。

插值更加精确,但是可能会导致过度拟合;拟合则更加灵活,能够通过调整参数来平衡拟合精度和模型复杂度。

二、插值方法1. 线性插值线性插值是一种简单的插值方法,通过已知数据点构造出线段,然后根据插值点在线段上进行线性插值得到插值结果。

2. 拉格朗日插值拉格朗日插值是一种基于多项式插值的方法,通过已知数据点构造出一个多项式,并根据插值点求解插值多项式来得到插值结果。

3. 分段线性插值分段线性插值是一种更加灵活的插值方法,通过将插值区间分成若干小段,然后在每个小段上进行线性插值。

三、拟合方法1. 最小二乘法拟合最小二乘法是一种常用的拟合方法,通过最小化实际观测点和拟合函数之间的残差平方和来确定拟合函数的参数。

2. 多项式拟合多项式拟合是一种基于多项式函数的拟合方法,通过选择合适的多项式次数来逼近已知数据点。

3. 曲线拟合曲线拟合是一种更加灵活的方法,通过选择合适的曲线函数来逼近已知数据点,常见的曲线包括指数曲线、对数曲线和正弦曲线等。

四、插值与拟合的应用场景插值和拟合在实际应用中具有广泛的应用场景,比如图像处理中的图像重建、信号处理中的滤波器设计、金融中的风险评估等。

五、插值与拟合的性能评价插值和拟合的性能可以通过多种指标进行评价,常见的评价指标包括均方根误差、相关系数和拟合优度等。

六、总结插值和拟合是数值计算方法中常用的技术,通过已知数据点来近似表达未知数据。

插值通过已知数据点构造出连续函数或曲线,拟合则找到逼近已知数据的函数或曲线。

计算机科学专业英语词汇

计算机科学专业英语词汇

计算机科学专业英语词汇
1. Introduction
该文档旨在提供计算机科学专业中常用的英语词汇,帮助读者加深对计算机科学领域的理解。

以下是一些常见的词汇及其解释。

2. Terms and Definitions
- Algorithm: 算法,计算机问题求解的具体步骤。

- Database: 数据库,用于存储和管理数据的系统。

- Encryption: 加密,将数据转换为无法读取和理解的形式。

- Firewall: 防火墙,用于保护计算机和网络不受未授权访问和攻击的安全设备。

- Java: 一种广泛使用的计算机编程语言。

- LAN (Local Area Network): 局域网,指在小范围内连接计算机和设备的网络。

- Operating System: 操作系统,控制和管理计算机硬件和软件资源的软件。

- Python: 一种流行的高级计算机编程语言。

- SQL (Structured Query Language): 结构化查询语言,用于数据库管理的标准语言。

- Virtual Reality: 虚拟现实,一种模拟现实环境的计算机技术。

3. Conclusion
通过掌握这些常用计算机科学专业英语词汇,读者可以更好地理解和应用计算机科学领域的知识。

在研究和实践中,不断积累和扩充词汇量将有助于提升专业能力和沟通交流能力。

希望这份文档能对您有所帮助!。

插值和拟合区别

插值和拟合区别
>> f=inline('a(1)*exp(-a(2)*x)+a(3)*… exp(-a(4)*x).*sin(a(5)*x)','a','x');
>> [xx,res]=lsqcurvefit(f,[1,1,1,1,1],x,y); xx',res
Optimization terminated successfully: Relative function value changing by less than
125.29*x^4+74.450*x^327.672*x^2+4.9869*x+.42037e-6
最小二乘曲线拟合
• 格式: [a, jm]=lsqcurvefit(Fun,a0,x,y)
例 >> x=0:.1:10; >> y=0.12*exp(-0.213*x)+0.54*exp(-0.17*x).*sin(1.23*x);
2*x0).*exp(-4*x0) x0.^2]; >> y1=A1*c; >> plot(x0,y1,x,y,'x')

• 数据分析
>> x=[1.1052,1.2214,1.3499,1.4918,1.6487,1.8221,2.0138,... 2.2255,2.4596,2.7183,3.6693];
0.1200 0.2130 0.5400 0.1700 1.2300 res = 9.5035e-021
• 绘制曲线: >> x1=0:0.01:10; y1=f(xx,x1); plot(x1,y1,x,y,'o')

计算机科学与技术专业英语

计算机科学与技术专业英语

计算机科学与技术专业英语Computer Science and Technology Major计算机科学与技术专业(jìsuànjī kēxué yǔ jìshù zhuānyè) - Computer Science and Technology Major计算机科学与技术(Computer Science and Technology)是计算机科学与技术学科的核心专业,主要培养学生具有计算机科学与技术专业的基本理论、基本知识和基本技能,能够在计算机科学与技术领域从事应用与开发、设计与实施、管理与服务等工作。

Computer Science and Technology is a core major in the field of computer science and technology. It mainly focuses on cultivating students with basic theories, knowledge, and skills in computer science and technology. Graduates will be able to engage in application development, design and implementation, management, and service in the field of computer science and technology.专业课程(zhuānyè kèchéng) - Major Courses计算机科学与技术专业的课程包括但不限于以下方面:The courses of the Computer Science and Technology major include but are not limited to the following aspects:1.基础课程(basic courses):- 计算机组成原理(Computer Organization and Architecture)- 数据结构与算法(Data Structures and Algorithms)- 操作系统(Operating Systems)- 离散数学(Discrete Mathematics)- 编译原理(Compiler Design)- 计算机网络(Computer Networks)2.核心课程(core courses):- 计算机图形学(Computer Graphics)- 数据库系统(Database Systems)- 人工智能(Artificial Intelligence)- 计算机安全(Computer Security)- 软件工程(Software Engineering)- 分布式系统(Distributed Systems)3.专业选修课程(major elective courses):- 数据挖掘(Data Mining)- 机器学习(Machine Learning)- 物联网技术(Internet of Things)- 云计算(Cloud Computing)- 嵌入式系统(Embedded Systems)就业方向(jiùyè fāngxiàng) - Career Paths计算机科学与技术专业的毕业生在以下领域有广泛的就业机会: Graduates of the Computer Science and Technology major have extensive job opportunities in the following fields:- 软件开发(Software Development)- 网络安全(Network Security)- 数据分析(Data Analysis)- 人工智能与机器学习(Artificial Intelligence and Machine Learning)- 云计算与大数据(Cloud Computing and Big Data)- 嵌入式系统开发(Embedded System Development)- 网站设计与开发(Website Design and Development)- IT管理与咨询(IT Management and Consulting)以上是关于计算机科学与技术专业的简单介绍。

计算机专业毕业论文外文翻译

计算机专业毕业论文外文翻译

附录(英文翻译)Rich Client Tutorial Part 1The Rich Client Platform (RCP) is an exciting new way to build Java applications that can compete with native applications on any platform. This tutorial is designed to get you started building RCP applications quickly. It has been updated for Eclipse 3.1.2By Ed Burnette, SASJuly 28, 2004Updated for 3.1.2: February 6, 2006IntroductionTry this experiment: Show Eclipse to some friends or co-workers who haven't seen it before and ask them to guess what language it is written in. Chances are, they'll guess VB, C++, or C#, because those languages are used most often for high quality client side applications. Then watch the look on their faces when you tell them it was created in Java, especially if they are Java programmers.Because of its unique open source license, you can use the technologies that went into Eclipse to create your own commercial quality programs. Before version 3.0, this was possible but difficult, especially when you wanted to heavily customize the menus, layouts, and other user interface elements. That was because the "IDE-ness" of Eclipse was hard-wired into it. Version 3.0 introduced the Rich Client Platform (RCP), which is basically a refactoring of the fundamental parts of Eclipse's UI, allowing it to be used for non-IDE applications. Version 3.1 updated RCP with new capabilities, and, most importantly, new tooling support to make it easier to create than before.If you want to cut to the chase and look at the code for this part you can find it in the accompanying zip file. Otherwise, let's take a look at how to construct an RCP application.Getting startedRCP applications are based on the familiar Eclipse plug-in architecture, (if it's not familiar to you, see the references section). Therefore, you'll need to create a plug-in to be your main program. Eclipse's Plug-in Development Environment (PDE) provides a number of wizards and editors that take some of the drudgery out of the process. PDE is included with the Eclipse SDK download so that is the package you should be using. Here are the steps you should follow to get started.First, bring up Eclipse and select File > New > Project, then expand Plug-in Development and double-click Plug-in Project to bring up the Plug-in Project wizard. On the subsequent pages, enter a Project name such as org.eclipse.ui.tutorials.rcp.part1, indicate you want a Java project, select the version of Eclipse you're targeting (at least 3.1), and enable the option to Create an OSGi bundle manifest. Then click Next >.Beginning in Eclipse 3.1 you will get best results by using the OSGi bundle manifest. In contrast to previous versions, this is now the default.In the next page of the Wizard you can change the Plug-in ID and other parameters. Of particular importance is the question, "Would you like to create a rich client application?". Select Yes. The generated plug-in class is optional but for this example just leave all the other options at their default values. Click Next > to continue.If you get a dialog asking if Eclipse can switch to the Plug-in Development Perspective click Remember my decision and select Yes (this is optional).Starting with Eclipse 3.1, several templates have been provided to make creating an RCP application a breeze. We'll use the simplest one available and see how it works. Make sure the option to Create a plug-in using one of the templates is enabled, then select the Hello RCP template. This isRCP's equivalent of "Hello, world". Click Finish to accept all the defaults and generate the project (see Figure 1). Eclipse will open the Plug-in Manifest Editor. The Plug-in Manifest editor puts a friendly face on the various configuration files that control your RCP application.Figure 1. The Hello World RCP project was created by a PDE wizard.Taking it for a spinTrying out RCP applications used to be somewhat tedious. You had to create a custom launch configuration, enter the right application name, and tweak the plug-ins that were included. Thankfully the PDE keeps track of all this now. All you have to do is click on the Launch an Eclipse Application button in the Plug-in Manifest editor's Overview page. You should see a bare-bones Workbench start up (see Figure 2).Figure 2. By using thetemplates you can be up andrunning anRCPapplication inminutes.Making it aproductIn Eclipse terms a product is everything that goes with your application, including all the other plug-ins it depends on, a command to run the application (called the native launcher), and any branding (icons, etc.) that make your application distinctive. Although as we've just seen you can run a RCP application without defining a product, having one makes it a whole lot easier to run the application outside of Eclipse. This is one of the major innovations that Eclipse 3.1 brought to RCP development.Some of the more complicated RCP templates already come with a product defined, but the Hello RCP template does not so we'll have to make one.In order to create a product, the easiest way is to add a product configuration file to the project. Right click on the plug-in project and select New > Product Configuration. Then enter a file name for this new configuration file, such as part1.product. Leave the other options at their default values. Then click Finish. The Product Configuration editor will open. This editor lets you control exactly what makes up your product including all its plug-ins and branding elements.In the Overview page, select the New... button to create a new product extension. Type in or browse to the defining plug-in(org.eclipse.ui.tutorials.rcp.part1). Enter a Product ID such as product, and for the Product Application selectorg.eclipse.ui.tutorials.rcp.part1.application. Click Finish to define the product. Back in the Overview page, type in a new Product Name, for example RCP Tutorial 1.In Eclipse 3.1.0 if you create the product before filling inthe Product Name you may see an error appear in the Problems view. The error will go away when you Synchronize (see below). This is a known bug that is fixed in newer versions. Always use the latest available maintenance release for the version of Eclipse you're targeting!Now select the Configuration tab and click Add.... Select the plug-in you just created (org.eclipse.ui.tutorials.rcp.part1) and then click on Add Required Plug-ins. Then go back to the Overview page and press Ctrl+S or File > Save to save your work.If your application needs to reference plug-ins that cannot be determined until run time (for example the tomcat plug-in), then add them manually in the Configuration tab.At this point you should test out the product to make sure it runs correctly. In the Testing section of the Overview page, click on Synchronize then click on Launch the product. If all goes well, the application should start up just like before.Plug-ins vs. featuresOn the Overview page you may have noticed an option that says the product configuration is based on either plug-ins or features. The simplest kind of configuration is one based on plug-ins, so that's what this tutorial uses. If your product needs automatic update or Java Web Start support, then eventually you should convert it to use features. But take my advice and get it working without them first.Running it outside of EclipseThe whole point of all this is to be able to deploy and run stand-alone applications without the user having to know anything about the Java and Eclipse code being used under the covers. For a real application you may want to provide a self-contained executable generated by an install program like InstallShield or NSIS. That's really beyond the scope of this article though, so we'll do something simpler.The Eclipse plug-in loader expects things to be in a certain layout so we'll need to create a simplified version of the Eclipse install directory. This directory has to contain the native launcher program, config files,and all the plug-ins required by the product. Thankfully, we've given the PDE enough information that it can put all this together for us now.In the Exporting section of the Product Configuration editor, click the link to Use the Eclipse Product export wizard. Set the root directory to something like RcpTutorial1. Then select the option to deploy into a Directory, and enter a directory path to a temporary (scratch) area such as C:\Deploy. Check the option to Include source code if you're building an open source project. Press Finish to build and export the program.The compiler options for source and class compatibility in the Eclipse Product export wizard will override any options you have specified on your project or global preferences. As part of the Export process, the plug-in is code is recompiled by an Ant script using these options.The application is now ready to run outside Eclipse. When you're done you should have a structure that looks like this in your deployment directory:RcpTutorial1| .eclipseproduct| eclipse.exe| startup.jar+--- configuration| config.ini+--- pluginsmands_3.1.0.jarorg.eclipse.core.expressions_3.1.0.jarorg.eclipse.core.runtime_3.1.2.jarorg.eclipse.help_3.1.0.jarorg.eclipse.jface_3.1.1.jarorg.eclipse.osgi_3.1.2.jarorg.eclipse.swt.win32.win32.x86_3.1.2.jarorg.eclipse.swt_3.1.0.jarorg.eclipse.ui.tutorials.rcp.part1_1.0.0.jarorg.eclipse.ui.workbench_3.1.2.jarorg.eclipse.ui_3.1.2.jarNote that all the plug-ins are deployed as jar files. This is the recommended format starting in Eclipse 3.1. Among other things this saves disk space in the deployed application.Previous versions of this tutorial recommended using a batch file or shell script to invoke your RCP program. It turns out this is a bad idea because you will not be able to fully brand your application later on. For example, you won't be able to add a splash screen. Besides, theexport wizard does not support the batch file approach so just stick with the native launcher.Give it a try! Execute the native launcher (eclipse or eclipse.exe by default) outside Eclipse and watch the application come up. The name of the launcher is controlled by branding options in the product configuration.TroubleshootingError: Launching failed because the org.eclipse.osgi plug-in is not included...You can get this error when testing the product if you've forgotten to list the plug-ins that make up the product. In the Product Configuration editor, select the Configuration tab, and add all your plug-ins plus all the ones they require as instructed above.Compatibility and migrationIf you are migrating a plug-in from version 2.1 to version 3.1 there are number of issues covered in the on-line documentation that you need to be aware of. If you're making the smaller step from 3.0 to 3.1, the number of differences is much smaller. See the References section for more information.One word of advice: be careful not to duplicate any information in both plug-in.xml and MANIFEST.MF. Typically this would not occur unless you are converting an older plug-in that did not use MANIFEST.MF into one that does, and even then only if you are editing the files by hand instead of going through the PDE.ConclusionIn part 1 of this tutorial, we looked at what is necessary to create a bare-bones Rich Client application. The next part will delve into the classes created by the wizards such as the WorkbenchAdvisor class. All the sample code for this part may be found in the accompanying zip file.ReferencesRCP Tutorial Part 2RCP Tutorial Part 3Eclipse Rich Client PlatformRCP Browser example (project org.eclipse.ui.examples.rcp.browser)PDE Does Plug-insHow to Internationalize your Eclipse Plug-inNotes on the Eclipse Plug-in ArchitecturePlug-in Migration Guide: Migrating to 3.1 from 3.0Plug-in Migration Guide: Migrating to 3.0 from 2.1译文:Rich Client教程第一部分The Rich Client Platform (RCP)是一种创建Java应用程序的令人兴奋的新方法,可以和任何平台下的自带应用程序进行竞争。

计算机专业外文资料翻译

计算机专业外文资料翻译

英文文献Object persistence and JavaBy Arsalan Saljoughy, , 05/01/97Object durability, or persistence, is the term you often hear used in conjunction with the issue of storing objects in databases. Persistence is expected to operate with transactional integrity, and as such it is subject to strict conditions. (See the Resources section of this article for more information on transaction processing.) In contrast, language services offered through standard language libraries and packages are often free from transactional constraints.As we'll see in this article, evidence suggests that simple Java persistence will likely stem from the language itself, while sophisticated database functionality will be offered by database vendors.No object is an islandIn the real world, you rarely find an object that lacks relations to other objects. Objects are components of object models. The issue of object durability transcends the issue of object model durability and distribution once we make the observation that objects are interconnected by virtue of their relations to one another.The relational approach to data storage tends to aggregate data by type. Rows in a table represent the physical aggregate of objects of the same type on disk. The relationships among objects are then represented by keys that are shared across many tables. Although through database organization, relational databases sometimes allow tables that are likely to be used together to be co-located (or clustered) in the same logical partition, such as a database segment, they have no mechanism to store object relationships in the database. Hence, in order to construct an object model, these relationships are constructed from the existing keys at run time in a process referred to as table joins. This is the same well-known property of the relational databases called data independence. Nearly all variants of object databases offer some mechanism to enhance the performance of a system that involves complex object relationships over traditional relational databases.To query or to navigate?In storing objects on disk, we are faced with the choice of co-locating related objects to better accommodate navigational access, or to store objects in table-like collections that aggregate objects by type to facilitate predicate-based access (queries), or both. The co-location of objects in persistent storage is an area where relational and object-oriented databases widely differ. The choice of the query language is another area of consideration. Structured Query Language (SQL) and extensions of it have provided relational systems with a predicate-basedaccess mechanism. Object Query Language (OQL) is an object variant of SQL, standardized by ODMG, but support for this language is currently scant. Polymorphic methods offer unprecedented elegance in constructing a semantic query for a collection of objects. For example, imagine a polymorphic behavior for acccount called isInGoodStanding. It may return the Boolean true for all accounts in good standing, and false otherwise. Now imagine the elegance of querying the collection of accounts, where inGoodStanding is implemented differently based on business rules, for all accounts in good standing. It may look something like:setOfGoodCustomers = setOfAccounts.query(account.inGoodStanding());While several of the existing object databases are capable of processing such a query style in C++ and Smalltalk, it is difficult for them to do so for larger (say, 500+ gigabytes) collections and more complex query expressions. Several of the relational database companies, such as Oracle and Informix, will soon offer other, SQL-based syntax to achieve the same result. Persistence and typeAn object-oriented language aficionado would say persistence and type are orthogonal properties of an object; that is, persistent and transient objects of the same type can be identical because one property should not influence the other. The alternative view holds that persistence is a behavior supported only by persistable objects and certain behaviors may apply only to persistent objects. The latter approach calls for methods that instruct persistable objects to store and retrieve themselves from persistent storage, while the former affords the application a seamless view of the entire object model -- often by extending the virtual memory system. Canonicalization and language independenceObjects of the same type in a language should be stored in persistent storage with the same layout, regardless of the order in which their interfaces appear. The processes of transforming an object layout to this common format are collectively known as canonicalization of object representation. In compiled languages with static typing (not Java) objects written in the same language, but compiled under different systems, should be identically represented in persistent storage.An extension of canonicalization addresses language-independent object representation. If objects can be represented in a language-independent fashion, it will be possible for different representations of the same object to share the same persistent storage.One mechanism to accomplish this task is to introduce an additional level of indirection through an interface definition language (IDL). Object database interfaces can be made through the IDL and the corresponding data structures. The downside of IDL style bindings is two fold: First, the extra level of indirection always requires an additional level of translation, which impacts the overall performance of the system; second, it limits use of database services that are unique to particular vendors and that might be valuable to application developers.A similar mechanism is to support object services through an extension of the SQL. Relational database vendors and smaller object/relational vendors are proponents of this approach; however, how successful these companies will be in shaping the framework for object storage remains to be seen.But the question remains: Is object persistence part of the object's behavior or is it an external service offered to objects via separate interfaces? How about collections of objects and methods for querying them? Relational, extended relational, and object/relational approaches tend to advocate a separation between language, while object databases -- and the Java language itself -- see persistence as intrinsic to the language:Native Java persistence via serializationObject serialization is the Java language-specific mechanism for the storage and retrieval of Java objects and primitives to streams. It is worthy to note that although commercial third-party libraries for serializing C++ objects have been around for some time, C++ has never offered a native mechanism for object serialization. Here's how to use Java's serialization: // Writing "foo" to a stream (for example, a file)// Step 1. Create an output stream// that is, create bucket to receive the bytesFileOutputStream out = new FileOutputStream("fooFile");// Step 2. Create ObjectOutputStream// that is, create a hose and put its head in the bucketObjectOutputStream os = new ObjectOutputStream(out)// Step 3. Write a string and an object to the stream// that is, let the stream flow into the bucketos.writeObject("foo");os.writeObject(new Foo());// Step 4. Flush the data to its destinationos.flush();The Writeobject method serializes foo and its transitive closure -- that is, all objects that can be referenced from foo within the graph. Within the stream only one copy of the serialized object exists. Other references to the objects are stored as object handles to save space and avoid circular references. The serialized object starts with the class followed by the fields of each class in the inheritance hierarchy.// Reading an object from a stream// Step 1. Create an input streamFileInputStream in = new FileInputStream("fooFile");// Step 2. Create an object input streamObjectInputStream ins = new ObjectInputStream(in);// Step 3. Got to know what you are readingString fooString = (String)ins.readObject();Foo foo = (Foo)s.readObject();Object serialization and securityBy default, serialization writes and reads non-static and non-transient fields from the stream. This characteristic can be used as a security mechanism by declaring fields that may not be serialized as private transient. If a class may not be serialized at all, writeObject and readObject methods should be implemented to throw NoAccessException.Persistence with transactional integrity: Introducing JDBCModeled after X/Open's SQL CLI (Client Level Interface) and Microsoft's ODBC abstractions, Java database connectivity (JDBC) aims to provide a database connectivity mechanism that is independent of the underlying database management system (DBMS).To become JDBC-compliant, drivers need to support at least the ANSI SQL-2 entry-level API, which gives third-party tool vendors and applications enough flexibility for database access.JDBC is designed to be consistent with the rest of the Java system. Vendors are encouraged to write an API that is more strongly typed than ODBC, which affords greater static type-checking at compile time.Here's a description of the most important JDBC interfaces:java.sql.Driver.Manager handles the loading of drivers and provides support for new database connections.java.sql.Connection represents a connection to a particular database.java.sql.Statement acts as a container for executing an SQL statement on a given connection.java.sql.ResultSet controls access to the result set.You can implement a JDBC driver in several ways. The simplest would be to build the driver as a bridge to ODBC. This approach is best suited for tools and applications that do not require high performance. A more extensible design would introduce an extra level of indirection to the DBMS server by providing a JDBC network driver that accesses the DBMS server through a published protocol. The most efficient driver, however, would directly access the DBMS proprietary API.Object databases and Java persistenceA number of ongoing projects in the industry offer Java persistence at the object level. However, as of this writing, Object Design's PSE (Persistent Storage Engine) and PSE Pro are the only fully Java-based, object-oriented database packages available (at least, that I am aware of). Check the Resources section for more information on PSE and PSE Pro.Java development has led to a departure from the traditional development paradigm for software vendors, most notably in the development process timeline. For example, PSE and PSE Pro are developed in a heterogeneous environment. And because there isn't a linking step in the development process, developers have been able to create various functional components independent of each other, which results in better, more reliable object-oriented code.PSE Pro has the ability to recover a corrupted database from an aborted transaction caused by system failure. The classes that are responsible for this added functionality are not present in the PSE release. No other differences exist between the two products. These products are what we call "dribbleware" -- software releases that enhance their functionality by plugging in new components. In the not-so-distant future, the concept of purchasing large, monolithic software would become a thing of the past. The new business environment in cyberspace, together with Java computing, enable users to purchase only those parts of the object model (object graph) they need, resulting in more compact end products.PSE works by post-processing and annotating class files after they have been created by the developer. From PSE's point of view, classes in an object graph are either persistent-capable or persistent-aware. Persistent-capable classes may persist themselves while persistent-aware classes can operate on persistent objects. This distinction is necessary because persistence may not be a desired behavior for certain classes. The class file post-processor makes the following modifications to classes:Modifies the class to inherit from odi.Persistent or odi.util.HashPersistent.Defines the initializeContents() method to load real values into hollow instances of your Persistent subclass. ObjectStore provides methods on the GenericObject class that retrieves each Field type.Be sure to call the correct methods for the fields in your persistent object. A separate method is available for obtaining each type of Field object. ObjectStore calls the initializeContents() method as needed. The method signature is:public void initializeContents(GenericObject genObj)Defines the flushContents() method to copy values from a modified instance (active persistent object) back to the database. ObjectStore provides methods on the GenericObject Be sure to call the correct methods for the fields in your persistent object. A separate method is available for setting each type of Field object. ObjectStore calls the flushContents() method as needed. The method signature is:public void flushContents(GenericObject genObj)Defines the clearContents() method to reset the values of an instance to the default values. This method must set all reference fields that referred to persistent objects to null. ObjectStore calls this method as needed. The method signature is:public void clearContents()Modifies the methods that reference non-static fields to call the Persistent.fetch() and Persistent.dirty() methods as needed. These methods must be called before the contents of persistent objects can be accessed or modified, respectively. While this step is not mandatory, it does provide a systematic way to ensure that the fetch() or dirty() method is called prior to accessing or updating object content.Defines a class that provides schema information about the persistence-capable class.All these steps can be completed either manually or automatically.PSE's transaction semanticYou old-time users of ObjectStore probably will find the database and transaction semantics familiar. There is a system-wide ObjectStore object that initializes the environment and is responsible for system-wide parameters. The Database class offers methods (such as create, open, and close), and the Transaction class has methods to begin, abort, or commit transactions. As with serialization, you need to find an entry point into the object graph. The getRoot and setRoot methods of the Database class serve this function. I think a few examples would be helpful here. This first snippet shows how to initialize ObjectStore:ObjectStore.initialize(serverName, null);try {db = Database.open(dbName, Database.openUpdate);} catch(DatabaseNotFoundException exception) {db = Database.create(dbName, 0664);}This next snippet shows how to start and commit a transaction:Transaction transaction = Transaction.begin(Transaction.update);try {foo = (Foo)db.getRoot("fooHead");} catch(DatabaseRootNotFoundException exception) {db.createRoot("fooHead", new Foo());}mit();The three classes specified above -- Transaction, Database, and ObjectStore -- are fundamental classes for ObjectStore. PSE 1.0 does not support nested transactions, backup and recovery, clustering, large databases, object security beyond what is available in the language, and any type of distribution. What is exciting, however, is all of this functionality will be incrementally added to the same foundation as the product matures.About the authorArsalan Saljoughy is asystems engineer specializing in object technology at Sun Microsystems. He earned his M.S. in mathematics from SUNY at Albany, and subsequently was a research fellow at the University of Berlin. Before joining Sun, he worked as a developer and as an IT consultant to financial services companies.ConclusionAlthough it is still too early to establish which methodology for object persistence in general and Java persistence in particular will be dominant in the future, it is safe to assume that a myriad of such styles will co-exist. The shift of storing objects as objects without disassembly into rows and columns is sure to be slow, but it will happen. In the meantime, we are more likely to see object databases better utilized in advanced engineering and telecommunications applications than in banking and back-office financial applications.英文翻译对象持久化和Java-深入的了解面向对象语言中的对象持久的讨论Arsalan Saljoughy,, 05/01/97对象持久化这个术语你常常会和数据存储一起听到。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

外文原文:PADE APPROXIMATION BY RATIONAL FUNCTION 129We can apply this formula to get the polynomial approximation directly for a given function f (x), without having to resort to the Lagrange or Newtonpolynomial. Given a function, the degree of the approximate polynomial, and the left/right boundary points of the interval, the above MATLAB routine “cheby()” uses this formula to make the Chebyshev polynomial approximation.The following example illustrates that this formula gives the same approximate polynomial function as could be obtained by applying the Newton polynomial with the Chebyshev nodes.Example 3.1. Approximation by Chebyshev Polynomial. Consider the problem of finding the second-degree (N = 2) polynomial to approximate the function 2()1/(18)f x x =+. We make the following program “do_cheby.m ”, which uses the MATLAB routine “cheby()” for this job and uses Lagrange/Newton polynomial with the Chebyshev nodes to do the same job. Readers can run this programto check if the results are the same.3.4 PADE APPROXIMATION BY RATIONAL FUNCTIONPade approximation tries to approximate a function f (x) around a point xo by a rational function00,00020012002012()()()()()()1()()()M M N N M M N N Q x x p x x D x x q q x x q x x q x x d x x d x x x x --=-+-+--+-+-+-++=+d (3.4.1)where 00(2)0()0(),'(),(),,()M N f x f x f x f x + are known.How do we find such a rational function? We write the Taylor series expansion of f (x) up to degree M + N at x = xo as130 INTERPOLATION AND CURVE FITTING(2)0()000000200020012()()()()()'()()()()2()!()()()(3.4.2)M N M NM N M N M N f x f x f x T x x f x f x x x x x x x M N a a x x a x x a x x +++++≈-=+-+-++-+=+-+-++- Assuming 0x =0for simplicity, we get the coefficients of ()()N M D x andQ x such that()()0()M M N N Q x T x D x +-=011011()(1)()01M N N N M N N N N N a a x a x d x d x q q x q x d x d x ++++++++-+++=+++01101()(1)()M N N N M N N N a a x a x d x d x q q x q x ++++++++=+++ (3.4.3) by solving the following equations:0010112110221122111212112212000M M M M N N M M M M M N N M M M M N N M N M N M N M N a q a a d q a a d a d q a a d a d a d q a a d a d a d a a d a d a d a a d a d a d ---+--+++-++++=⎧⎪+=⎪⎪+=⎪⎪⎪⎨⎪=⎪+=⎪⎪⎪⎪=⎩++++++++++++(3.4.4a )(3.4.4b ) Here, we must first solve Eq. (3.4.4b) for N d d d ,,,21 and then substitute di ’sinto Eq. (3.4.4a) to obtain M q q q ,,,10The MATLAB routine “padeap()” implements this scheme to find the coefficient vectors of the numerator/denominator polynomial )(/)(x D x Q N M of thePade approximation for a given function f (x). Note the following things:ž The derivatives (2)()000'(),(),,()M N f x f x f x + up to order (M + N ) arecomputed numerically by using the routine “difapx()”, that will be introduced in Section 5.3.ž In order to compute the values of the Pade approximate function, we substitute 0x x - for x in ,()M N p x which has been obtained with the assumptionthat 0x =0.PADE APPROXIMATION BY RATIONAL FUNCTION 131Example 3.2. Pade Approximation for ()x f x e = . Let’s find the Padeapproximation3,232()()/()p x Q x D x = for ()x f x e = around 0x =0. We make theMATLAB program “do_pade.m ”, which uses the routine “padeap()” for thisjob and uses it again with no output argument to see the graphic results as depicted in Fig. 3.6.To confirm and support this result from the analytical point of view and to help the readers understand the internal mechanism, we perform the hand-calculation 132 INTERPOLATION AND CURVE FITTINGFigure 3.6 Pade approximation and Taylor series expansion for f(x) = ex(Example 3.2.).procedure. First, we write the Taylor series expansion at x = 0 up to degreeM + N = 5 for the given function ()xasf x e()230()11()1!23!K M Nk y k f x T x x x x x k +===++++∑ (E3.2.1) whose coefficients are0123111,1,,,26a a a a ==== (E3.2.2)We put this into Eq. (3.4.4b) with M = 3,N = 2 and solve it for di ’s to get2212431223211211221()10,02/51/61/21/24,/201/241/61/120D x d x d x a a d a d a a d a d d d d d a =++++=++=--⎡⎤⎡⎤⎡⎤⎡⎤⎡⎤==⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥-⎣⎦⎣⎦⎣⎦⎣⎦⎣⎦ (E3.2.3)Substituting this to Eq. (3.4.4a) yields001101221102332112111(2/5)3/51/21(2/5)1(1/20)3/201/6(1/2)(2/5)1(1/20)1/60q a q a a d q a a d a d q a a d a d ===+=+⨯-==++=+⨯-+⨯==++=+⨯-+⨯= (E3.2.4) INTERPOLATION BY CUBIC SPLINE 133 With these coefficients, we write the Pade approximate function as2333,222322()1(3/5)(3/20)(1/60)()()1(2/5)(1/20)(1/3)31220820Q x x x x p x D x x x x x x x x +++===+-++++-+ (E3.2.5)3.5 INTERPOLATION BY CUBIC SPLINEIf we use the Lagrange/Newton polynomial to interpolate a given set of N + 1data points, the polynomial is usually of degree N and so has N − 1 local extrema (maxima/minima). Thus, it will show a wild swing/oscillation (called ‘polynomial wiggle’), particularly near the ends of the whole interval as the number of datapoints increases and so the degree of the polynomial gets higher, as illustratedin Fig. 3.2. Then, how about a piecewise-linear approach, like assigning theindividual approximate polynomial to every subinterval between data points?How about just a linear interpolation —that is, connecting the data points bya straight line? It is so simple, but too short of smoothness. Even with thesecond-degree polynomial, the piecewise-quadratic curve is not smooth enoughto please our eyes, since the second-order derivatives of quadratic polynomials for ad jacent subintervals can’t be made to conform with each other. In real life, there are many cases where the continuity of second-order derivatives isdesirable. For example, it is very important to ensure the smoothness up to order 2 for interpolation needed in CAD (computer-aided design)/CAM (computer-aided manufacturing), computer graphic, and robot path/trajectory planning. That’s why we often resort to the piecewise-cubic curve constructed by the individual thirddegree polynomials assigned to each subinterval, which is called the cubic splineinterpolation. (A spline is a kind of template that architects use to draw a smooth curve between two points.)For a given set of data points {(,),0:}k k x y k N =, the cubic spline s(x)consists of N cubic polynomial ()k s x ’s assigned to each subinterval satisfying the following constraints (S0)–(S4).(S0)32,3,2,1,01()()()()(),[,],0:k k k k k k k k k k s x s x S x x S x x S x x S x x x k N +==-+-+-+∈=for (S1),0()0:k k k k s x S y k N ===,for(S2)1,0()(),1:1k k k k k k s x s x S y k N -≡===-for(S3)1,1'()'(),1:1k k k k k s x s x S k N -≡==-for(S4)1,2''()''()2,1:1k k k k k s x s x S k N -≡==-forThese constraints (S1)–(S4) amount to a set of N + 1 + 3(N − 1) = 4N − 2linear equations having 4N coefficients of the N cubic polynomials,0,1,2,3{,,,,0:1}k k k k S S S S k N =-134 INTERPOLATION AND CURVE FITTINGTable 3.4 Boundary Conditions for a Cubic Splineas their unknowns. Two additional equations necessary for the equations to besolvable are supposed to come from the boundary conditions for the first/secondorder derivatives at the end points (x 0, y 0) and (xN, yN ) as listed in Table 3.4.Now, noting from (S1) that ,0k k S y =, we will arrange the constraints (S2)–(S4)and eliminate Sk,1, Sk,3’s to set up a set of equations with respect to the N + 1 unknowns ,2{,0:}k S k N =. In order to do so, we denote each interval width by 1k k k h x x +=- and substitute (S0) into (S4) to write1,3,2111,2,31,2,2''()62''()21()3k k k k k k k k k k k k s x S h S s x S S h S S +++++=+≡==- (3.5.1a)1,31,21,21()3k k k k S h S S ---=- (3.5.1b) We substitute these equations into (S2) with k + 1 in place of k321,31,21,11,0132,3,2,11()()()()k k k k k k k k k k k k k k k k k k k k k s x S x x S x x S x x S y S h S h S h y y ++++++=-+-+-+≡+++≡to eliminate ,3k S ’s and rewrite it as11,2,2,2,1()3k k k k k k k k k kh y y S S S h S dy h ++--++== 1,2,2,1(2)33k k k k k h S S S dy +++= (3.5.2a ) 1,21,21,11(2)33k k k k k h S S S dy ----++= (3.5.2b ) We also substitute Eq. (3.5.1b) into (S3)211,311,211,1,1'()3k k k k k k k k s x S h S h S S ------=++≡INTERPOLATION BY CUBIC SPLINE 135to write,11,11,21,211,21,21,2()2()k k k k k k k k k k S S h S S h S h S S --------=-+=+ (3.5.3)In order to use this for eliminating Sk,1 from Eq. (3.5.2), we subtract (3.5.2b) from (3.5.2a) to write1,2,21,21,2,11,11(2)(2)3(2)3()k k k k k k k k k k h S S h S S S S dy dy +----+-++-=-and then substitute Eq. (3.5.3) into this to write1,2,21,21,21,21,2111,21,21,21(2)(2)3()3()()3()k k k k k k k k k k k k k k k k k k k k h S S h S S h S S dy dy h S h h S h S dy dy +--------+-+-+++=-+++=- (3.5.4)for k = 1 : N − 1 Since these are N − 1 equations with respect to N + 1 unknowns ,2{,0:}k S k N =, we need two more equations from the boundary conditions to be given aslisted in Table 3.4.How do we convert the boundary condition into equations? In the case where the first-order derivatives on the two boundary points are given as (i) in Table 3.4, we write Eq. (3.5.2a) for k = 0 as01,20,20,1000,201,200,1(2)33,233h S S S dy h S h S dy S ++=+=- (3.5.5a )We also write Eq. (3.5.2b) for k = N as1,21,21,11(2)33N N N N N h S S S dy ----++=and substitute (3.5.3)(k = N ) into this to write01,20,20,10(2)33h S S S dy ++=1,21,21,11,21,2111,21,2,11(2)33(2)323()N N N N N N N N N N N N N N h S S S h S S dy h S h S S dy ----------++-+=+=- (3.5.5b)Equations (3.5.5a) and (3.5.5b) are two additional equations that we need to solve Eq. (3.5.4) and that’s it. In the case where the second -order derivatives on the two boundary points are given as (ii) in Table 3.4, 0,2S and ,2N S are directly known from the boundary conditions as0,200''()/2S s x =,,2''()/2N N N S s x = (3.5.6) 136 INTERPOLATION AND CURVE FITTINGand, subsequently, we have just N − 1 unknowns. In the case where the secondorderderivatives on the two boundary points are given as (iii) in Table 3.4we can instantly convert these into two equations with respect to S 0,2 and SN,2 as Finally, we combine the two equations (3.5.5a) and (3.5.5b) with Eq. (3.5.4) to write it in the matrix –vector form as0,200,1001,21000111,2122211,2,11113()203()2()003()2()3()02N N N N N N N N N N N N S dy S h h S dy dy h h h h S dy dy h h h h S S dy h h -----------⎡⎤⎡⎤⎡⎤⎢⎥⎢⎥⎢⎥-+⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥=⎢⎥⎢⎥⎢⎥-+⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥-⎣⎦⎣⎦⎣⎦ (3.5.8) After solving this system of equation for {Sk,2, k = 0 : N }, we substitute theminto (S1), (3.5.2), and (3.5.1) to get the other coefficients of the cubic spline asThe MATLAB routine “cspline()” constructs Eq.(3.5.8), solves it to get the cubic spline coefficients for given x, y coordinates of the data points and the boundary conditions, uses the mkpp() routine to get the piecewise polynomialexpression, and then uses the ppval() routine to obtain the value(s) of the piecewise polynomial function for xi —that is, the interpolation over xi. The type ofthe boundary condition is supposed to be specified by the third input argument KC. In the case where the boundary condition is given as (i)/(ii) in Table 3.4,the input argument KC should be set to 1/2 and the fourth and fifth input arguments must be the first/second derivatives at the end points. In the case wherethe boundary condition is given as extrapolated like (iii) in Table 3.4, the input argument KC should be set to 3 and the fourth and fifth input arguments do not need to be fed.INTERPOLATION BY CUBIC SPLINE 137(cf) See Problem 1.11 for the usages of the MATLAB routines mkpp() and ppval(). Example 3.3. Cubic Spline. Consider the problem of finding the cubic spline interpolation for the N + 1 = 4 data pointssubject to the boundary condition(E3.3.2)With the subinterval widths on the x-axis and the first divided differences as138INTERPOLATION AND CURVE FITTINGwe write Eq. (3.5.8) as0,200,11,2102,2213,23,113()210033()141063()014163()00123S dy S S dy dy S dy dy S S dy --⎡⎤⎡⎤⎡⎤⎡⎤⎢⎥⎢⎥⎢⎥⎢⎥-⎢⎥⎢⎥⎢⎥⎢⎥==⎢⎥⎢⎥-⎢⎥⎢⎥-⎢⎥⎢⎥⎢⎥⎢⎥-⎣⎦⎣⎦⎣⎦⎣⎦(E3.3.4)Then we solve this equation to get and substitute this into Eq. (3.5.9) to obtain0,01,02,000,102,20,211,112,21,222,123,21,21,20,20,301,21,21,313,22,30,1,4( 3.3.6)(2)2( 3.3.7)3(2)2( 3.3.7)3(2)2( 3.3.7)32( 3.3.8)32( 3.3.8)3S S S E h S dy S S E a hS dy S S E b h S dy S S E c S S S E a h S S S E b h S S ====-+==-+==-+=-==-==--=2,222( 3.3.8)3S E c h =Figure 3.7 Cubic splines for Example 3.3.Finally, we can write the cubic spline equations collectively from (S0) asWe make and run the program “do_csplines.m”, which uses the routine“cspline()” to compute the cubic spline coefficientsand obtain the value(s) of the cubicspline function for i x(i.e., theinterpolation over xi) and then plots the result as depicted in Fig. 3.7. We also compare this result with that obtained by using the MATLAB built-in function “spline(x,y,xi)”, which works with the boundary condition of type (i) for the second input argument given as [dy0 y dyN], and with the boundary conditionof type (iii) for the same lengths of x and y.3.6 HERMITE INTERPOLATING POLYNOMIALIn some cases, we need to find the polynomial function that not only passes through the given points, but also has the specified derivatives at every data point. We call such a polynomial the Hermite interpolating polynomial or the osculating polynomial.140 INTERPOLATION AND CURVE FITTINGFor simplicity, we consider a third-order polynomialmatching just two points and having the specified first derivativesat the points. We can obtain the four coefficients by solvingAs an alternative, we approximate the specified derivatives at the data points by their differencesand find the Lagrange/Newton polynomial matching the four pointsThe MATLAB routine “hermit()” constructs Eq. (3.6.2) and solves it to getthe Hermite interpolating polynomial coefficients for a single interval given thetwo end points and the derivatives at them as the input arguments. The next routine “hermits()” uses “hermit()” to get the Hermite coefficients for a setof multiple subintervals.Example 3.4. Hermite Interpolating Polynomial. Consider the problem of finding the polynomial interpolation for the N + 1 = 4 data pointsTWO-DI MENSIONAL INTERPOLATION 141subject to the conditionsFor this problem, we only have to type the following statements in the MATLAB command window.3.7 TWO-DIMENSIONAL INTERPOLATIONIn this section we deal with only the simplest way of two-dimensional interpolation—that is, a generalization of piecewise linear interpolation calledFigure 3.8 A two-dimensional interpolation using Zi = interp2() on the grid points [Xi,Yi] generated by the meshgrid() command.142 INTERPOLATION AND CURVE FITTINGthe bilinear interpolation. The bilinear interpolation for a point (x, y ) on the rectangularsub-region having and as its left-upper/right-lower corner points is described by the following formula.11111,1111,11,11,11(,)(,)(,)1{()()()()()()()()()()},,n n n n n n n n m n m n m m n n m n m n m n m n m n m n m m n ny y y y z x y z x y z x y y y y y x x y y z x x y y x x y y z x x y y z x x y y z x x x y y y -----------------=+--=----+--+--+--≤≤≤≤for (3.7.2)This formula is cast into the MATLAB routine “intrp2()”, which is so named in order to distinguish it from the MATLAB built-in routine “interp2()”. Note that in reference to Fig. 3.8, the given values of data at grid points (x(m),y(n)) and the interpolated values for intermediate points (xi(m),yi(n)) are stored in Z(n,m) and Zi(n,m), respectively.CURVE FITTING 143Example 3.5. Two-Dimensional Bilinear Interpolation. We consider interpolating the sample values of a functionfor the 5 × 5 grid over the 21 × 21 grid on the domainWe make the MATLA B program “do_interp2.m”, which uses the routine“intrp2()” to do this job, compares its function with that of the MATLABbuilt-in routine “interp2()”, and computes a kind of relative error to estimatehow close the interpolated values are to the original values. The graphic resultsof running this program are depicted in Fig. 3.9, which shows that we obtaineda reasonable approximation with the error of 2.6% from less than 1/16 of the original data. It is implied that the sampling may be a simple data compression method, as long as the interpolated data are little impaired.3.8 CURVE FITTINGWhen many sample data pairs {(xk, yk), k = 0 : M} are available, we often need to grasp the relationship between the two variables or to describe the trend of the(a) True function (b) The function over (c) Bilinear interpolation Figure 3.9 Two-dimensional interpolation (Example 3.5).144 INTERPOLATION AND CURVE FITTINGsample grid data, hopefully in a form of function y = f (x). But, as mentioned in Remark 3.1,the polynomial approach meets with the polynomial wiggle and/or Runge phenomenon,which makes it not attractive for approximation purpose. Although thecubic spline approach may be a roundabout toward the smoothness as explainedin Section 3.5, it has too many parameters and so does not seem to be an efficient way of describing the relationship or the trend, since every subintervalneeds four coefficients. What other choices do we have? Noting that many data are susceptible to some error, we don’t ha ve to try to find a function passing exactly through every point. Instead of pursuing the exact matching at every data point, we look for an approximate function (not necessarily a polynomial) that describes the data points as a whole with the smallest error in some sense, whichis called the curve fitting.As a reasonable means, we consider the least-squares (LS) approach to minimizing the sum of squared errors, where the error is described by the verticaldistance to the curve from the data points. We will look over various types of fitting functions in this section.3.8.1 Straight Line Fit: A Polynomial Function of First DegreeIf there is some theoretical basis on which we believe the relationship betweenthe two variables to bewe should set up the following system of equations from the collection of many experimental data:Noting that this apparently corresponds to the overdetermined case mentionedin Section 2.1.3, we resort to the least-squares (LS) solution (2.1.10)which minimizes the objective functionCURVE FITTING 145Sometimes we have the information about the error bounds of the data, and it is reasonable to differentiate the data by weighing more/less each one according toits accuracy/reliability. This policy can be implemented by the weighted leastsquares (WLS) solutionwhich minimizes the weighted objective functionIf the weighting matrix is, then we can write the WLS solution (3.8.5) aswhereOne may use the MATLAB built-in routine “lscov(A,y,V)” to obtain thisWLS solution.3.8.2 Polynomial Curve Fit: A Polynomial Function of Higher DegreeIf there is no reason to limit the degree of fitting polynomial to one, then we may increase the degree of fitting polynomial to, say, N in expectation of decreasing the error. Still, we can use Eq. (3.8.4) or (3.8.6), but with different definitions of A and θ asThe MATLAB routine “polyfits()” performs the WLS or LS scheme tofind the coefficients of a polynomial fitting a given set of data points, depending on whether or not a vector (r) having the diagonal elements of the weighting matrix W is given as the fourth or fifth input argument. Note that in the case of a diagonal weighting matrix W, the WLS solution conforms to the LS solution with each row of the information matrix A and the data vector y multiplied by the corresponding element of the weighting matrix W. Let us see the following examples for its usage:146 INTERPOLATION AND CURVE FITTINGExample 3.6. Polynomial Curve Fit by LS (Least Squares). Suppose we havein two columns and we must fit these data into polynomials of degree 1, 3, 5, and 7.We make the MATLAB program “do_polyfit.m”, which uses the routine “polyfits()” to do this job and plot the results together with the given dataCURVE FITTING 147Figure 3.10 Polynomial curve fitting by the LS (Least-Squares) method.points as depicted in Fig. 3.10. We can observe the polynomial wiggle that the oscillation of the fitting curve between the data points becomes more pronounced with higher degree.Example 3.7. Curve Fitting by WLS (Weighted Least Squares). Most experimental data have some absolute and/or relative error bounds that are not uniform forall data. If we know the error bounds for each data, we may give each data a weight inversely proportional to the size of its error bound when extracting valuable information from the data. The WLS solution (3.8.7) enables us to reflect sucha weighting strategy on estimating data trends. Consider the following two cases. (a) Suppose there are two gauges A and B with the same function, but different absolute error bounds ±0.2 and ±1.0, respectively. We used themto get the input-output data pair (xm,ym) as{(1, 0.0831), (3, 0.9290), (5, 2.4932), (7, 4.9292), (9, 7.9605)} from gauge A {(2, 0.9536), (4, 2.4836), (6, 3.4173), (8, 6.3903), (10, 10.2443)} from gauge B Let the fitting function be a second-degree polynomial function148 INTERPOLATION AND CURVE FITTING(a) Fitting to a polynomial (b) Fitting toFigure 3.11 LS curve fitting and WLS curve fitting for Example 3.7.To find the parameters a2, a1, and a0, we write the MATLAB program“do_wlse1.m”, which uses the routine “polyfits()” twice, once without weighting coefficients and once with weighting coefficients. The resultsare depicted in Fig. 3.11a, which shows that the WLS curve fitting triesto be closer to the data points with smaller error bound, while the LScurve fitting weights all data points equally, which may result in larger deviations from data points with small error bounds.(b) Suppose we use one gauge that has relative error bound ±40[%] for measuring the output y for the input values x = [1, 3, 5, . . . , 19] and sothe size of error bound of each output data is proportional to the magnitudeof the output. We used it to get the input–output data pair (xm,ym) as{(1, 4.7334), (3, 2.1873), (5, 3.0067), (7, 1.4273), (9, 1.7787)(11, 1.2301), (13, 1.6052), (15, 1.5353), (17, 1.3985), (19, 2.0211)}Let the fitting function be an exponential functiony = axb (E3.7.2)To find the parameters a and b, we make the MATLAB program“do_wlse2.m”, which uses the routine “curve_fit()” without the weighting coefficients one time and with the weighting coefficients another time.The results depicted in Fig. 3.11b shows that the WLS curve fitting tries toget closer to the data points with smaller |y|, while the LS curve fitting pays equal respect to all data points, which may result in larger deviation fromdata points with small |y|. Note that the MATLAB routine “curve_fit()”appears in Problem 3.11, which implements all of the schemes listed inTable 3.5 with the LS/WLS solution.CURVE FITTING 149(cf) Note that the objective of the WLS scheme is to put greater emphasis on more reliable data.中文译文:插值与拟合我们能够运用这个公式直接得到给定函数f(x)的近似多项式估计,没有必要采取拉格朗日或牛顿多项式。

相关文档
最新文档