freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

matlab編程第三章(已修改)

2025-10-07 22:41 本頁(yè)面
 

【正文】 10/23/2022 1 Chapter 3 Branching Statements and Program Design Chapter 3 Branching Statements and Program Design 10/23/2022 Hangzhou Dianzi University 2 Se qu en t i al P ro gr am s — F i xe d or de rCo nt ro l t he o rd erBranche s Loo psCo m pl ex p ro gr amA f or m al p ro gr am d es i gn p ro ce du re — Top do wn Des i gnChapter 3 Branching Statements and Program Design 10/23/2022 Hangzhou Dianzi University 3 Introduction to TopDown Design Techniques What‘s the most difficult part of program job? ans: To understand the problem you are trying to solve. Chapter 3 Branching Statements and Program Design 10/23/2022 Hangzhou Dianzi University 4 Topdown design It is the process of starting with a large task and breaking down into smaller, more easily understandable pieces (subtasks), which perform a portion of the desired task. Each subtask may in turn be subdivided into smaller subtasks if necessary. Each subtask can be coded an tested independently. Chapter 3 Branching Statements and Program Design 10/23/2022 Hangzhou Dianzi University 5 St ar tSt ar t t he p r og r am y ou ar e t r yi ng t o so l veDef i ne r eq ui r ed i np ut s an d ou t pu t sDes i gn t he a l go r i t hmCo nv er t a l go r i t hm i nt o M ATLAB s t at em en t sTe st t he r es ul t i ng M ATLAB p r og r amDec om po si t i onSt ep wi se r ef i ne m en tFi ni sh ed !Chapter 3 Branching Statements and Program Design 10/23/2022 Hangzhou Dianzi University 6 1. Clearing state the problem that you are trying to solve. 2. Define the inputs required by the program and the outputs to be produced by the program. 3. Design the algorithm that you intend to implement in the program. ? deposition ? stepwise refinement pseudocode 4. Turn the algorithm into MATLAB statements. 5. Test the resulting MATLAB program. Chapter 3 Branching Statements and Program Design 10/23/2022 Hangzhou Dianzi University 7 St ar tUni t te st in g of individu al subta sksSu cces si ve bu il ds( add in g su bt as ks t o th e p r og r am )Beta r el eas eFi ni sh ed pr og r am !Su bt as ks v al id at ed se par at el yAs m any t im es as n eces sa r ySu bt as ks co m bi ned i nt o a s in gl e p r og r amAlp ha r el eas e As m any t im es as n eces sa r yWo r st b ug s f ix edAs m any t im es as n eces sa r yM in or b ug s f ix edChapter 3 Branching Statements and Program Design 10/23/2022 Hangzhou Dianzi University 8 Good Programming Practice Follow the step of the program design process to produce reliable, understandable MATLAB programs. 1/3 : plan what to do. 1/6 : write the program. 1/2 : test and debug. Chapter 3 Branching Statements and Program Design 10/23/2022 Hangzhou Dianzi University 9 Use of Pseudocode ?Constructs (Structure) ?Structured algorithm ?Structured program Chapter 3 Branching Statements and Program Design 10/23/2022 Hangzhou Dianzi University 10 Pseudocode A hybrid mixture of MATLAB and English. Prompt user to enter temperature in degrees Fahrenheit Read temperature in degrees Fahrenheit (temp_f) temp_k in kelvins ← (5/9) * ( temp_f – 32 ) + Write temperature in kelvins Chapter 3 Branching Statements and Program Design 10/23/2022 Hangzhou Dianzi University 11 Relational and Logical operators Two type of operators can produce true/false result in MATLAB : relational operators and logic operators. MATLAB does not have boolean or logical data type. MATLAB interprets a zero value as false result。 any nonzero value as true result. Chapter 3 Branching Statements and Program Design 10/23/2022 Hangzhou Dianzi University 12 Relational Operators a1 op a2 a1 and a2 are arithmetic expressions, variables, or strings. Operator Operation = = Equal to ~ = Not equal to Greater than = Greater than or equal to Less than = Less than or equal to Chapter 3 Branching Statements and Program Design 10/23/2022 Hangzhou Dianzi University 13 3 4 3 = 4 3 = = 4 3 4 4 = 4 39。A39。 39。B39。 1 1 0 0 1 1 Chapter 3 Branching Statements and Program Design 10/23/2022 Hangzhou Dianzi University 14 ?Scalar value with array ?Array with array 0b?1021a??? ?????ab?10an s01??? ????1021a??? ?????0221b??? ??????ab??10a ns11??? ????Chapter 3 Branching Statements and Program Design 10/23/2022 Hangzhou Dianzi University 15 1. Both array must have the same size (or shape)。 2. Since strings are really arrays of characters, relational operators can only pare two strings if they are of equal lengths Programming Pitfalls Be careful not to confuse the equivalence relational operator (==) with the assignment operator (=). Chapter 3 Branching Statements and Program Design 10/23/2022 Hangzhou Dianzi University 16 Hierarchy: Relational operators are lower than all arithmetic operators. 7 + 3 2 + 11 (7 + 3) (2 + 11) Chapter 3 Branching Statements and Program Design 10/23/2022 Hangzhou Dianzi University 17 A Caution about the == and ~= Operators a = 0。 b = sin (pi)。 a = = b ans = ? ans = 0 sin (pi) = 1016 Chapter 3 Branching Statements and Program Design 10/23/2022 Hangzhou Dianzi University 18 Roundoff Errors: During puter calculations, two theoretically equal numbers can differ slightly, causing an equality or inequality test to fail. Solution: abs (a b) an
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評(píng)公示相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
公安備案圖鄂ICP備17016276號(hào)-1