




已閱讀5頁(yè),還剩7頁(yè)未讀, 繼續(xù)免費(fèi)閱讀
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
大連交通大學(xué)2009屆本科生畢業(yè)設(shè)計(jì)(論文)外文翻譯外文原文introduction to matlabmatlab (short for matrix laboratory) is a special-purpose computer program optimized to perform engineering and scientific calculations. it started life has a program designed to perform matrix mathematics, but over the years it has grown into a flexible computing system capable of solving essentially any technical problem.the matlab program implements the matlab programming language and provides an extensive library of predefined functions that make technical programming tasks easier and more efficient. this book introduces the matlab language and shows how to use it to solve typical technical problems.matlab is a huge program, with an incredibly rich variety of functions. even the basic version of matlab without any toolkits is much richer than other technical programming languages. there are more than 1000 functions in the basic matlab product alone,and the toolkits extend this capability with many more functions in various specialties. this book makes no attempt to introduce the user to all of maltlabs own tools to locate the correct function for a specific purpose from the enormous choice available.advantages of matlab matlab has many advantages compared with conventional computer languages for technical problem solving. among them are the following:1. ease of usematlab is an interpreted language, like many versions of basic. like basic, it is very easy to use. the program can be used as a scratch pad to evaluate expressions typed at the command line, or it can be used to execute large prewritten programs. programs may be easily written and modified with the built-in integrated development environment, and debugged with the matlab debugger. because the language is so easy to use, it is ideal for educational use, and for the rapid prototyping of new programs. many program development tools are provided to make the program easy to use. a workspace browser, and extensive demos.2. platform independence matlab is supported on many different computer systems, providing a large measure of platform independence. at the time of this writing, the language is supported on windows 9x/nt/2000 and many different versions of unix. programs written on any platform will run on all of the other platforms, and data files written on any platform may be read transparently on any other platforms, as a result,programs written in matlab can migrate to new platforms when the needs of the user change.3. predefined functionsmatlab comes complete with an extensive library of predefined functions that provide tested and prepackaged solutions to many basic technical tasks. for example, suppose that you are writing a program that must calculate the statistics associated with an input data set. in most languages, you would need to write your own subroutines or functions to implement calculations such as the arithmetic mean, standard deviation, median, and so forth. these and hundreds of other functions are built right into the matlab language, making your job much easier.in addition to the large library of functions built into the basic matlab language, many special-purpose toolboxes are available to help solve complex problems in specific areas. for example, a user can buy standard toolboxes to solve problems in signal processing, control systems, communications, image processing, and neural networks, among many others. there is also an extensive collection of free user-contributed matlab programs that are shared through the matlab web site.4. device-independent plottingunlike most other computer languages, matlab has many integral plotting and imaging commands. the plots and images can be displayed on any graphical output device supported by the computer on which matlab is running. this capability makes matlab an outstanding tool for visualizing technical data.5. graphical user interfacematlab includes tools that allow a programmer to interactively construct a graphical user interface (gui) for his or her program. with this capability, the programmer can design sophisticated data analysis programs that can be operated by relatively inexperienced users.6. matlab compilermatlabs flexibility and platform independence is achieved by compiling matlab programs into a device-independence p-code, and then interpreting the p-code instructions at run time. this approach is similar to that used by microsoft is visual basic language. unfortunately, the resulting programs can sometimes execute slowly because the matlab code is interpreted rather than compiled. we will point out features that tend to slow program execution when we encounter them. a separate matlab compiler is available. this compiler can compile a matlab program into a true executable that runs faster than the interpreted code. it is a great way to convert a prototype matlab program into an executable suitable for sale and distribution to users.disadvantages of matlab matlab has two principal disadvantages. the first is that it is an interpreted language, and therefore can execute more slowly than compiled languages. this problem can be mitigated by properly structuring the matlab program and by the use of the matlab compiler to compile the final matlab program before distribution and general use.the second disadvantage is cost: a full copy of matlab is 5 to 10 times more expensive than a conventional c or fortran compiler. this relatively high cost is more than offset by the reduced time required for an engineer or scientist to create a working program, so matlab is cost-effective for businesses. however, it is too expensive for most individuals to consider purchasing. fortunately, there is also an inexpensive student edition of matlab, which is a great tool for students wanting to learn the language. the student edition of matlab is essentially identical to the full edition.with the introduction of branches and loops, our programs are going to become more complex, and it will get easier to make mistakes. to help avoid programming errors, we will introduce a formal program design procedure based on the technique known as top-down design. we will also introduce a common algorithm development tool known as pseudo code.introduction to top-down design techniquessuppose that you are an engineer working in industry, and that you need to write a program to solve some problem. how do you begin? when given anew problem, there is a natural tendency to sit down at a keyboard and start programming without “wasting” a lot of time thinking about the problem first. it is often possible to get away with this “on the fly” approach to programming for very small problems, such as many of the examples in this book. in the real world, however, problems are larger, and a programmer attempting this approach will become hopelessly bogged down. for larger problems, it pays to completely think out the problem and the approach you are going to take to it before writing a single line of code. we introduce a formal program design process in this section, and then apply that process to every major application developed in the remainder of the book. for some of the simple examples that we will be doing, the design process will seem like overkill; however, as the problems that we solve get larger and larger, the process becomes more and more essential to successful programming.when i was an undergraduate, one of my professors was fond of saying, “programming is easy. it is knowing what to program that is hard.” his point was forcefully driven home to me after i left university and began working in industry on larger scale software projects. i found that the most difficult port of my job was to understand the problem i was trying to solve. once i really understood the problem, it became easy to break the problem apart into smaller, more easily manageable pieces with well-defined functions, and then to tackle those pieces one at a time.top-down design is the process of starting with a large task and breaking it down into smaller, more easily understandable pieces, which perform a portion of the desired task. each subtask may in turn be subdivided into smaller subtasks if necessary. once the program is divided into small pieces, each piece can be coded and tested independently. we do not attempt to combine the subtasks into a complete task until each of the subtasks has been verified to work properly by itself.the concept of top-down design is the basis of our formal program design process. we will now introduce the details of the process, which is illustrated in figure 1 the steps involved are:1. clearly state the problem that you are trying to solve.programs are usually written to fill some perceived need, but that need may not be articulated clearly by the person requesting the program. for example, a user may ask for a program to solve a system of simultaneous linear equations. this request is not clear enough to allow a programmer to design a program to meet the need; he or she must first know much more about the problem to be solved. is the system of equations to be solved real or complex? what is the maximum number of equations and unknown that the program must handle? are there any symmetry in the equations that might be exploited to make the task easier? the program designer will have to talk with the user requesting the program, and the two of them will have come up with a clear statement of exactly what they are trying to accomplish. a clear statement of the problem will prevent misunderstandings, and it will also help the program designer to properly organize his or her thoughts. in the example we were describing, a proper statement of the problem might have been: figure 1design and write a program to solve a system of simultaneous linear equations having real coefficients and with up to 20 equations in 20 unknowns.2. define the inputs required by the program and the outputs to be produced by the program.the inputs to the program and the outputs produced by the program must be specified so that the new program will properly fit into the overall processing scheme. in this example, the coefficients of the equations to be solved are probably in some pre-existing order, and our new program needs to be able to read them in that order. and our new program needs to be able to read them in that order. similarly, it needs to produce the answers required by the programs that may follow it in the overall processing scheme, and to write out those answers in the format needed by the programs following it.3. design the algorithm that you intend to implement in the program.an algorithm is a step-by-step procedure for finding the solution to a problem. it is at this stage in the process that top-down design techniques come into play. the designer looks for logical divisions within the problem, and divides it up into subtasks along those lines. this process is called decomposition. if the subtasks are large, the designer can break them up into even smaller sub-tasks. this process continues until the problem has been divided into many small pieces, each of which does a simple, clearly understandable job.after the problem has been decomposed into small pieces, each piece is further refined through a process called stepwise refinement. in stepwise refinement, a designer starts with a general description of what the piece of code should do, and then defines the functions of the piece in greater and greater detail until they are specific enough to be turned into matlab statements. stepwise refinement is usually done with pseudo code, which will be described in the next section.it is often helpful to solve a simple example of the problem by hand during the algorithm development process. if the designer understands the steps that he or she went through in solving the problem by hand, then he or she will be better able to apply decomposition and stepwise refinement to the problem.4. turn the algorithm into matlab statements.if the decomposition and refinement process was carried out properly, this step will be very simple. all the programmer will have to do is to replace pseudo code with the corresponding matlab statements on a one-for-one basis.5. test the resulting matlab programthis step is the real killer. the components of the program must first be tested individually, if possible, and then the program as a whole must be tested. when testing a program, we must verify that it works correctly for all legal input data sets. it is very common for a program to be written, tested with some standard data set, and released for use, only to find that it produces the wrong answers (or crashes) with a different input data set. if the algorithm implemented in a program includes different branches, we must test all of the possible branches to confirm that the program operates correctly under every possible circumstance.large programs typically go through a series of tests before they are released for general use (see figure 2). the first stage of testing is sometimes called unit testing. during unit testing, the individual subtasks of the program are tested separately to confirm that they work correctly. after the unit testing is completed, the program goes through a series of builds, during which the individual subtasks are combined to produce the final program. the first build of the program typically includes only a few of the subtasks. it is used to check the interactions among those subtasks and the functions performed by the combinations of the subtasks. in successive builds, more and more subtasks are added, until the entire program is complete. testing is performed on each build, and any errors(bugs) detected are corrected before moving on to the next build. figure 2中文翻譯matlab 介紹matlab (矩陣實(shí)驗(yàn)室的簡(jiǎn)稱)是一種專業(yè)的計(jì)算機(jī)程序,用于工程科學(xué)的矩陣數(shù)學(xué)運(yùn)算。但在以后的幾年內(nèi),它逐漸發(fā)展為一種極其靈活的計(jì)算體系,用于解決各種重要的技術(shù)問題。matlab 程序執(zhí)行matlab 語(yǔ)言,并提供了一個(gè)極其廣泛的預(yù)定義函數(shù)庫(kù),這樣就使得技術(shù)工作變得簡(jiǎn)單高效。本書將介紹matlab 語(yǔ)言,并向大家展示如何運(yùn)用它去解決經(jīng)典的技術(shù)問題。matlab 是一個(gè)龐大的程序,擁有難以置信的各種豐富的函數(shù);即使基本版本的matlab 語(yǔ)言擁有的函數(shù)也比其他的工程編程語(yǔ)言要豐富的多。基本的matlab 語(yǔ)言已經(jīng)擁有了超過1000 多個(gè)函數(shù),而它的工具包帶有更多的函數(shù),由此擴(kuò)展了它在許多專業(yè)領(lǐng)域的能力。本書無(wú)意將matlab 的所有函數(shù)介紹給大家,而是讓大家掌握編寫調(diào)試和優(yōu)化程序的基本功,還有一些重要函數(shù)的子集。所以從大量可利用的函數(shù)中篩選出你所需要的函數(shù)就顯得尤為重要。matlab 的優(yōu)點(diǎn)matlab 語(yǔ)言相對(duì)于傳統(tǒng)的科技編程語(yǔ)言有諸多的優(yōu)點(diǎn)。主要包括:1.易用性matlab 是種解釋型語(yǔ)言,就像各種版本的basic。和basic 一樣,它簡(jiǎn)單易用程序可用作便箋簿求打在命令行處表達(dá)式的值,也可執(zhí)行預(yù)先寫好的大型程序。在matlab 集成開發(fā)環(huán)境下,程序可以方便的編寫,修改和調(diào)試。這是因?yàn)檫@種語(yǔ)言極易使用,對(duì)于教育應(yīng)用和快速建立新程序的原型,它是一個(gè)理想的工具。許多的編程工具使得 matlab 十分簡(jiǎn)單易用。這些工具包括:一個(gè)集成的編譯/調(diào)試器,在線文件手冊(cè),工作臺(tái)和擴(kuò)展范例。2.平臺(tái)獨(dú)立性matlab 支持許多的操作系統(tǒng),提供了大量的平臺(tái)獨(dú)立的措施。在本書編寫的時(shí)侯, windows98/2000/nt 和許多版本的unix 系統(tǒng)都支持它。在一個(gè)平臺(tái)上編寫的程序,在其它平臺(tái)上一樣可以正常運(yùn)行,在一個(gè)平臺(tái)上編寫的數(shù)據(jù)文件在其它平臺(tái)上一樣可以編譯。因此用戶可以根據(jù)需要把matlab 編寫的程序移植到新平臺(tái)。3.預(yù)定義函數(shù)matlab 帶有一個(gè)極大的預(yù)定義函數(shù)庫(kù),它提供了許多已測(cè)試和打包過的基本工程問題的函數(shù)。例如,假設(shè)你正在編寫一個(gè)程序,這個(gè)程序要求你必須計(jì)算與輸入有關(guān)的統(tǒng)計(jì)量。在許多的語(yǔ)言中,你需要寫出你所編數(shù)組的下標(biāo)和執(zhí)行計(jì)算所需要的函數(shù),這些函數(shù)包括其數(shù)學(xué)意義,中值,標(biāo)準(zhǔn)誤差等。像這樣成百上千的函數(shù)已經(jīng)在matlab 中編寫好,所以讓編程變得更加簡(jiǎn)單。除了植入matlab 基本語(yǔ)言中的大量函數(shù),還有許多專用工具箱,以幫助用戶解決在具體領(lǐng)域的復(fù)雜問題。例如,用戶可以購(gòu)買標(biāo)準(zhǔn)的工具箱以解決在信號(hào)處理,控制系統(tǒng),通信,圖象處理,神經(jīng)網(wǎng)絡(luò)和其他許多領(lǐng)域的問題。4.機(jī)制獨(dú)立的畫圖與其他語(yǔ)言不同,matlab 有許多的畫圖和圖象處理命令。當(dāng)matlab 運(yùn)行時(shí),這些標(biāo)繪圖和圖片將會(huì)出現(xiàn)在這臺(tái)電腦的圖像輸出設(shè)備中。此功能使得matlab 成為一個(gè)形象化技術(shù)數(shù)據(jù)的卓越工具。5.用戶圖形界面matlab 允許程序員為他們的程序建立一個(gè)交互式的用戶圖形界面。利用matlab 的這種功能,程序員可以設(shè)計(jì)出相對(duì)于無(wú)經(jīng)驗(yàn)的用戶可以操作的復(fù)雜的數(shù)據(jù)分析程序。6.matlab 編譯器matlab 的靈活性和平臺(tái)獨(dú)立性是通過將matlab 代碼編譯成設(shè)備獨(dú)立的p 代碼,然后在運(yùn)行時(shí)解釋p 代碼來(lái)實(shí)現(xiàn)的。這種方法與微軟的vb 相類似。不幸的是,由于matlab 是解釋性語(yǔ)言,而不是編譯型語(yǔ)言,產(chǎn)生的程序執(zhí)行速度慢。當(dāng)我們遇到執(zhí)行速度慢的程序時(shí),我們將會(huì)指出其這一特性。matlab 的缺點(diǎn)matlab 有兩個(gè)基本的缺點(diǎn)。第一,它是解釋型語(yǔ)言,其執(zhí)行速度要比編譯型語(yǔ)言慢得多。這個(gè)問題可以通過合理的matlab 結(jié)構(gòu)得到緩解,也可以在發(fā)行廣泛使用前編譯出matlab 程序。第二,他的費(fèi)用較高。一個(gè)完全版matlab 編譯器的大小是一個(gè)c 語(yǔ)言或fortan 語(yǔ)言編譯器的5 到10倍。但matlab 能夠節(jié)省大量的時(shí)間在科技編程方面,故matlab 在商業(yè)編程過程中是節(jié)省成本的。盡管如此,相對(duì)于大多數(shù)考慮購(gòu)買的人還是很昂貴的。幸運(yùn)的是,它有一個(gè)價(jià)格便宜的學(xué)生專用版本,對(duì)學(xué)生來(lái)說它是學(xué)習(xí)matlab 語(yǔ)言的一個(gè)重要工具。學(xué)生版的matlab和完全版的matlab 是基本一致的。隨著選擇和循環(huán)介紹,我們的程序也將變得復(fù)雜,對(duì)于解決問題來(lái)說,將會(huì)變得簡(jiǎn)單。為了幫助大家避免在編程過程中出現(xiàn)大量的錯(cuò)誤,我們將向大家介紹正式的編程步驟,即自上而下的編程方法。我們也會(huì)向大家介紹一些普通的算法開發(fā)工具即偽代碼。自上而下的編程方法簡(jiǎn)介假設(shè)你是在工廠工作的工程師,為了解決某些問題,你要編寫一個(gè)程序。你如何開始呢?當(dāng)遇到一個(gè)新問題時(shí),我們的心里會(huì)自然而然的產(chǎn)生這樣的想法:馬上坐在計(jì)算機(jī)前
溫馨提示
- 1. 本站所有資源如無(wú)特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025江蘇揚(yáng)州工業(yè)職業(yè)技術(shù)學(xué)院博士專項(xiàng)招聘16人筆試備考試題完整參考答案詳解
- 2024年河北邯鄲成安縣事業(yè)單位招聘工作人員255名筆試備考試題含答案詳解
- 2025廣西來(lái)賓市招聘鄉(xiāng)村振興專員221人筆試備考題庫(kù)及參考答案詳解一套
- 2025年?yáng)|營(yíng)市公務(wù)員考試行測(cè)真題及答案詳解(名師系列)
- 山東省多校2024-2025學(xué)年高二下學(xué)期3月月考物理試題(解析版)
- 四川省涼山彝族自治州西昌市2024-2025學(xué)年高一上學(xué)期期中檢測(cè)物理試題(解析版)
- 跨國(guó)土木項(xiàng)目中的BIM應(yīng)用探索
- 房地產(chǎn)項(xiàng)目融資渠道的選擇
- 數(shù)學(xué)教學(xué)課件首頁(yè)
- 金融市場(chǎng)量化投資策略在區(qū)塊鏈技術(shù)背景下的創(chuàng)新報(bào)告
- 公路應(yīng)急搶險(xiǎn)協(xié)議書
- 國(guó)家中醫(yī)藥管理局直屬事業(yè)單位招聘筆試真題2024
- 2025年計(jì)算機(jī)Photoshop功能分析試題及答案
- 國(guó)際貿(mào)易銷售業(yè)務(wù)流程合規(guī)管理
- 2025-2030全球及中國(guó)商用P2PCDN行業(yè)市場(chǎng)現(xiàn)狀供需分析及投資評(píng)估規(guī)劃分析研究報(bào)告
- 建筑工程竣工驗(yàn)收合格證書(7篇)
- 康復(fù)醫(yī)學(xué)科護(hù)士長(zhǎng)競(jìng)聘
- 2025屆萍鄉(xiāng)市重點(diǎn)中學(xué)物理八下期末監(jiān)測(cè)試題含解析
- 2025年下半年(第二季度)重慶市巫溪縣事業(yè)單位招聘72人易考易錯(cuò)模擬試題(共500題)試卷后附參考答案
- 2025-2030年中國(guó)圓柱鋰離子電池行業(yè)市場(chǎng)現(xiàn)狀供需分析及投資評(píng)估規(guī)劃分析研究報(bào)告
- 工程造價(jià)控制試題及答案
評(píng)論
0/150
提交評(píng)論