ImageVerifierCode 换一换
格式:PPT , 页数:35 ,大小:95KB ,
资源ID:372980      下载积分:2000 积分
快捷下载
登录下载
邮箱/手机:
温馨提示:
如需开发票,请勿充值!快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝扫码支付 微信扫码支付   
注意:如需开发票,请勿充值!
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【http://www.mydoc123.com/d-372980.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(MatLab Palm Chapter 2, Part 3Cell Arrays, Structure Arrays.ppt)为本站会员(testyield361)主动上传,麦多课文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知麦多课文库(发送邮件至master@mydoc123.com或直接QQ联系客服),我们立即给予删除!

MatLab Palm Chapter 2, Part 3Cell Arrays, Structure Arrays.ppt

1、MatLab Palm Chapter 2, Part 3 Cell Arrays, Structure Arrays,Class 7.1 Chapter 2: Sections 6 & 7,Announcements,Departmental Presentations. (REQUIRED ACTIVITY) 10/12 7:00-9:00 p.m. See online Schedule You must turn in two, one-page critiques (LIMIT EACH CRITIQUE TO ONE PAGE!), one for each presentatio

2、n that you attend. Due: Thursday, October 21, 2004.,Presentation Make-Up,If you have a legitimate conflict: Go to your conflicting class. Write a critique of the lecture/lab following the format below (two pages if course conflicts with both sessions of presentations) . On your cover sheet, give the

3、 course, section, and time of your conflict. Non-course-related conflicts REQUIRE instructor approval.,Critique format,Introductory paragraph. Start with broad statement. Become more specific with sentences that define the engineering field you heard about. End with the topic sentence for your criti

4、que.,Critique format, continued.,Example Introduction:“Civil engineers design, build and maintain our nations infrastructure. They take courses in structures, water resources, geotechnical engineering, construction management, and environmental engineering. These courses prepare them to work in larg

5、e or small firms that are both governmental or private. Although there are specific areas that CE majors can focus in, many students choose the “General Track,” which requires them to take electives in each of the major areas within civil engineering. Because of its breadth, civil engineering is an

6、interesting field, and the presenters for the department were very effective at communicating their enthusiasm for this subject.”,Broad,Specific with definition,Topic Sentence,Critique format, continued.,Two to three supporting paragraphs. These paragraphs flesh out your topic sentence. They MUST co

7、ntain A transition from the previous paragraph A key sentence (may be part of transition) Supporting sentences A concluding sentence,Critique format, continued.,Example supporting paragraph:“Enthusiasm may be hard to define, but you know it when you see it. For instance, the geotechnical presenter h

8、ad positive body language and used many personal examples to explain the topic. She talked clearly, in an animated voice, using a lot of hand gestures. She also had energy and showed by her facial expression that she was happy to be there and to have the opportunity to talk to our class. One example

9、 that stood out in my mind was how geotechnical engineers have to ensure that neighboring buildings are not damaged when a new facility is constructed. The picture of the subway pit right next to a major high-rise hotel brought that message home. Because of the active and interesting presentation st

10、yle, this presentation kept my attention.”,Transition,Key sentence,Supporting sentences,Conclusion,Critique format, continued.,Conclusion paragraph. Should summarize the body of the critique and draw the important conclusions. Should NOT state substantially new material.,Critique format, continued.,

11、Example conclusion paragraph: “Through these many techniques, the Department of Civil Engineering made a strong presentation. Each presenter showed excitement, both through energy, inflection, and personal example, and through a communicated, genuine desire to inform us about their topic and to teac

12、h us. They were courteous in the way they treated late-comers and loud students, while not letting the presentation get out of control. They were also knowledgeable and able to answer questions. Hence, since this presentation was well-prepared and effectively delivered, I was encouraged that it was

13、a beneficial use of my time.”,Transition,Summary of supporting paragraphs,Final conclusion,Critique Style,Each paragraph should be about the same length. Sentences should vary in length.,Critique Details,Details (see example): 8 ” x 11” paper, 1.5 times line spacing. One-inch margins on all sides. T

14、imes New Roman font. 12pt, bold title (maximum of two lines) 11pt body paragraphs. Underline: Topic sentence, each key sentence, and your final conclusion sentence. Turn in three pages stapled (1) cover sheet with personal information, (2) critique #1, (3) critique #2.,Announcements, cont.,Next Mond

15、ay will be Case Studies, led by an industry sponsor (e.g. Dell, IBM, Frito Lay, Motorola, etc.) We may have handouts on Thursday, but make sure you arrive on time, and are courteous, attentive, and ready to work.,Team Exercise,Budgetary estimate: How much will it cost each firm to give the case stud

16、ies next week? Here is what we know: Each team will be on campus for one full day. Each team is two to four people. Case studies require (?) hours of extra preparation by (?) numbers of workers. Travel is from within Texas.,Budgetary Estimate,These costs are paid by the companies as part of their ou

17、treach/promotional budgets. This is probably a LOW estimate.,Team Exercise (Adapted from Palm Ch. 3, No. 10, p. 178),An object thrown vertically with a speed v0 reaches a height h at time t where:Write a function to compute h given v0 and t. It should allow t to be a vector. Use the function to PLOT

18、 (refer to p. 25) h versus t for t between 0 and 10 s and v0 = 50 m/s.,Function file (velocity.m),function h = velocity(v0, t) % % function h = velocity(v0, t) % % This function computes the height h of an object at the time t after it is % released. The initial speed of the object is v0. % INPUTS:

19、% v0 = initial speed (m/s) % t = time after release (s) % OUTPUTS: % h = height (m) % % S. Socolofsky % ENGR 111A: 501-503 % October 12, 2004% Define the acceleration of gravityg = 9.81; % m/s% Compute the heighth = v0 * t - 1/2 * g * t.2;% “dot“ not | allows t to be a vector. % needed |,Solution, v

20、_init = 50; t = 0:0.1:10; h = velocity(v_init, t); plot(t, h) xlabel(Time after release (s) ylabel(Height above release (m) title(Position of a vertically released object) grid on,Lec. 7.1 Learning Objectives,Understand the differences between vector, matrix, and structure arrays. Understand the def

21、initions for structure, record, and field. Be able to create a structure array using at least two different methods. Be able to store, retrieve, and manipulate data in the different fields of a structure array.,Cell Arrays,A Cell Array is an array where each index is also an array. Each index can be

22、 a different data type (i.e. you can have letters in one index and numbers in another). Allows you to give one name to a set of data that belong together.,Cell Arrays, continued.,You can create Cell Arrays in two ways. Cell Indexing: e.g. A(1,1) = Walden Content Indexing: e.g. A1,1 = Walden Note the

23、 functions in Table 2.6-1 (p. 112) celldisp() and cellplot() are useful commands.,Cell Practice,Type the following commands: A = 1:4, 0, 9, 2, 2:5, 6:8 celldisp(A) cellplot(A) A1,3 A(1,3) A(1,2) A1,2 A1,2(1,2) A(1,2)(1,3) % why it this an error? A1,2(1,3) % why does this work?,New Topic: Structure A

24、rrays,A structure array is a collection of records. A record is a set of related fields where each field may contain a different data type. A field is an array of data that defines a particular attribute of an object.structure array = employee; record = employee(3); List of fields: name, address, da

25、te of employment, salary. or The collection of fields comprise a record; the collections of records comprise a structure array.,3.7 Structure Arrays,Structure Arrays are like data objects in other languages. Structure(record).Field1 = vector Structure(record).Field2 = string Structure(record).Field3

26、 = numberFields can be arrays, character strings or numbers.,Structure Arrays,By definition: “Structures are multidimensional MATLAB arrays with elements accessed by textual field designators.” Examples Student.name %Data Type = Text Student(2).scores(3) %Data Type = Array of numbers.,Creating Struc

27、tures,Structures can be created dynamically by direct assignment to individual fields. array_name(index).field_name = field_valueAn entire record (element of the array) can be added with a single statement.Clue(n) = struct(field name 1,field-value-1, field name 2, field-value-2, .) When text values

28、are entered for a field they must be enclose in single quotes.Note: If there is only one record in a structure, there is no index needed between the array name and the field name. If more than one record exist then the index value must me given.,Sample of Direct Assignment,%Array names and fields ca

29、n be created and %assigned dynamically. Clue.who = Prof Plum; Clue.where = Study; Clue.what = Candlestick; disp(Clue)who: Prof Plumwhere: Studywhat: Candlestick,More Samples,%Even though no index was used in creating the %first record in Clue, another set can be appended %by using an index.Clue(2).w

30、ho = Ms. Scarlet; Clue(2).where = Library; Clue(2).what = Rope; disp(Clue(2)who: Ms. Scarletwhere: Librarywhat: Rope,Adding Fields,%New fields can be added after structures %have been created. Clue(2).turns = 15; % turns is a new field disp(Clue(2) % used 1st in record #2who: Ms. Scarletwhere: Libra

31、rywhat: Ropeturns: 15,Adding Fields,%Adding new fields will cause a null field in the %cells already defined. disp(Clue(1)who: Prof Plumwhere: Studywhat: Candlestickturns: %turns was not defined originally,The Array Function: struct(),%All fields (a complete record) can be assigned with one %stateme

32、nt. All text values are enclosed in quotes; %numerical data are not.Clue(3) = struct(who, Col Mustard, where, kitchen, what, revolver, turns, 22);disp(Clue(3)who: Col Mustardwhere: kitchenwhat: revolverturns: 22,Using Array Functions,What does this code segment do?Clue(1).turns = 17; avg_turns=sum(C

33、lue.turns)/length(Clue); disp(avg_turns)18,Using Array Functions,% Since Clue(1).turns is null, , we can assign it a value. Clue(1).turns = 17;%Below, notice the lack of an index for Clue and the square brackets %around Clue.turn. This combination returns a vector of turns to the %MATLAB function, s

34、um, which calculates the sum of that vector.%The length function returns the number of records in Clue. %Dividing the sum by the number of records gives us the average %of the numbers stored in turns. avg_turns = sum(Clue.turns)/length(Clue);%Then we display our results, show 18 as the average. disp

35、(avg_turns)18,Try This!,Use MATLAB to create a structure similar to the Clue Game Database in the examples. Try these commands in MATLAB Clue.who Clue Clue.who Clue(3).turns Clue.who Clue.where char(Clue.who) Clue(2).who Notice the different ways that the same data are presented.See a list of struct

36、ure related function in Table 2.7-1 on page 120 of the text.,RAT 7.1,Take out a piece of paper, write your name, team#, todays date and RAT 7.1. A structure array called profs has a field named college. How would you assign the value Engineering to this field for record number 2? You dont have to turn in your paper Answer: profs(2).college = Engineering,Assignment 7.1,INDIVIDUAL ASSIGNMENT Due: March 9, 2004 Chapter 2; #49, 51 (End of chapter problems) Test your understanding problems 2.7-1,2,3 (p. 123),

copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
备案/许可证编号:苏ICP备17064731号-1