MatLab – Palm Chapter 2, Part 3 Cell Arrays, Structure Arrays Class 7.1 Chapter 2: Sections 6 & 7.

Slides:



Advertisements
Similar presentations
HTML I. HTML Hypertext mark-up language. Uses tags to identify elements of a page so that a browser such as Internet explorer can render the page on a.
Advertisements

Professional Communication Letter Writing
Short Story Unit: Theme Assignment Preparation
SQ3R: A Reading Technique
Name: _____________________________________________ SS Period: _____ Date: _____________________ Africa Project 2008 February 11, 2008 Jambo Neptunes!
Chunking, Annotation, & Summary
CMPS 1371 Introduction to Computing for Engineers STRUCTURE ARRAYS.
Instructions for completing the ES089g term paper.
 The Literary Essay is an insightful, critical interpretation of a literary work.  It is not a summary of plot, character or other elements of fiction.
Copyright © 2003 by The McGraw-Hill Companies, Inc. All rights reserved. Business and Administrative Communication SIXTH EDITION.
Writing Effective Topic/Thesis Sentence
Class 9.1 Chapter 4 Sections: 4.1, 4.2, 4.3
Introduction to MATLAB Northeastern University: College of Computer and Information Science Co-op Preparation University (CPU) 10/22/2003.
Today’s quiz on 8.2 A Graphing Worksheet 1 will be given at the end of class. You will have 12 minutes to complete this quiz, which will consist of one.
Please open your laptops, log in to the MyMathLab course web site, and open Daily Quiz 16. IMPORTANT NOTE: If you have time left out of your five minutes.
 The Literary Essay is an insightful, critical interpretation of a literary work.  It is not a summary of plot, character or other elements of fiction.
Business Memo purpose of writer needs of reader Memos solve problems
Business Communications Effective Made E-Z.
BEIT 336: Week 2 – Class 1 Today’s Agenda In week 2 of this class, we will focus on Recommendation reports Recommendation reports Letter report format.
©2003 Pearson Education, Inc., publishing as Longman Publishers. Study Skills Topic 13 Preparing & Taking Exams PowerPoint by JoAnn Yaworski.
Getting the most points on your Final Paper
Brief Formatting February 22, What do I include? Look at the score sheet. Include every element on the score sheet. Make sure you leave enough time.
Getting the most points on your Fine Arts Report.
Science Fair Research Paper
Unit 6 The Multigenre Research Project. Unit 6 In this unit, you will select someone to study who has made significant contributions to society. You can.
Cornell Notes Note-taking strategy that will improve your study skills and your grades!!
I-Search Paper Purpose You will be writing a personal research paper, sometimes called an I-Search paper. You will pick a subject to which you have a personal.
Writing RESEARCH REPORTS MRS. A. KIM. Understanding the Research Report The Research Process Choosing your subject Doing preliminary research Limiting.
Please get out your completed 8.2B Graphing Worksheet 2 and pass it to the center aisle to be collected by the TA.
Introduction Session 01 Subject: S0012 / Introduction to Civil Engineering Year: 2009.
Spring 2012 Session 7 Dr. Alma Kadragic. Tonight’s program Reminder about Discuss Academic Writing.
16-1 Chapter 16 Analyzing Information & Writing Reports   Analyzing Data   Choosing Information   Organizing Reports   Seven Organization Patterns.
CS255 Communication Skills Aidan Mooney
Academic Presentation Skills 8 November 2011 Sources: Comfort, Jeremy Effective Presentations. Oxford University Press, Sweeney, Simon English.
ENG College of Engineering Engineering Education Innovation Center 1 Array Accessing and Strings in MATLAB Topics Covered: 1.Array addressing. 2.
REQUIREMENTS AND EXPECTATIONS THE KITE RUNNER LITERARY ESSAY.
CS161 Topic #16 1 Today in CS161 Lecture #16 Prepare for the Final Reviewing all Topics this term Variables If Statements Loops (do while, while, for)
Senior Project Rough Draft
Welcome to Seminar 8 “The wastebasket is a writer’s best friend,” by Isaac Bashevis Singer. -- Why do you think that is ?
Planning and Shaping Your Writing
Formal Essay Rules Research Papers. AP Research Paper Use the formula for the MP 1 Essay Use the formula for the MP 1 Essay Plot + Device = Meaning Plot.
NOTETAKING Adapted by Jane Luddy MEd.
Introduction to Engineering MATLAB – 4 Arrays Agenda Creating arrays of numbers  Vectors: 1-D Arrays  Arrays: 2-D Arrays Array Addressing Strings & String.
 Reading Quiz  Peer Critiques  Evaluating Peer Critiques.
Edit #1. Things of which to be aware:  You MUST have a turnitin.com receipt for your research paper (stapled to the back)…it is open now.  You must.
1 Faculty Name Prof. A. A. Saati. 2 MATLAB Fundamentals 3 1.Reading home works ( Applied Numerical Methods )  CHAPTER 2: MATLAB Fundamentals (p.24)
“A change of heart about animals” By jeremy Rifkin
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
King Saud University- College of Engineering- Dept of Chemical Engineering GUIDELINES AND RECOMMANDATIONS FOR THE PREPARATION OF GRADUATE PROJECT I AND.
Technical Report Outline Title Page Frontispiece Abstract Table of Contents List of Figures/ List of Tables.
This assignment is required for credit in Ms. Benton’s class. Speeches begin Friday, May 23. DO NOT PRINT IT OUT WITHOUT PERMISSION. We are low on ink.
Writing In History Professor Williams. OBJECTIVES The objective of this course is to broaden the students’ knowledge of the literature of specific fields.
Completing the Proposal: Understanding our Process and Requirements October 11, 2012 EPD 397 Sections 8 and 9.
The Literary Essay is an insightful, critical interpretation of a literary work.
AVID Ms. Richardson.
The Literary Essay is an insightful, critical interpretation of a literary work.
insightful, critical interpretation of a literary work
JavaScript: Functions.
Student Success Strategies
The Literary Essay is an insightful, critical interpretation of a literary work.
Series of Paragraphs Expressing an Opinion
Chapter 14 The Process of Writing an Essay
Essay #1: Your Goals as a Writer
Class 9.1 Chapter 4 Sections: 4.1, 4.2, 4.3
The Literary Essay is an insightful, critical interpretation of a literary work.
The Literary Essay is an insightful, critical interpretation of a literary work.
The Literary Essay is an insightful, critical interpretation of a literary work.
The Literary Essay is an insightful, critical interpretation of a literary work.
Student Success Strategies
FINAL YEAR PROJECT BRIEFING
Presentation transcript:

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 ScheduleSchedule You must turn in two, one-page critiques (LIMIT EACH CRITIQUE TO ONE PAGE!), one for each presentation 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 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 critique.

Critique format, continued. Example Introduction: “Civil engineers design, build and maintain our nation’s infrastructure. They take courses in structures, water resources, geotechnical engineering, construction management, and environmental engineering. These courses prepare them to work in large 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 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 contain 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 had 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 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 style, 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. 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 teach 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 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):example 8 ½” x 11” paper, 1.5 times line spacing. One-inch margins on all sides. Times 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 Monday 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 studies 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 outreach/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 v 0 reaches a height h at time t where: Write a function to compute h given v 0 and t. It should allow t to be a vector. Use the function to PLOT (refer to p. 25) h versus t for t between 0 and 10 s and v 0 = 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: % v0 = initial speed (m/s) % t = time after release (s) % OUTPUTS: % h = height (m) % % S. Socolofsky % ENGR 111A: % October 12, 2004 % Define the acceleration of gravity g = 9.81; % m/s % Compute the height h = v0 * t - 1/2 * g * t.^2; % ^ "dot" not | ^ allows t to be a vector. % needed |

Solution >> v_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 definitions 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 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. A{1,1} = ‘Walden’ Note the functions in Table (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) >> A{1,3} >> A(1,3) >> A(1,2) >> A{1,2} >> A{1,2}(1,2) >> A(1,2)(1,3) % why it this an error? >> A{1,2}(1,3) % why does this work?

New Topic: Structure Arrays 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, date 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 = number Fields 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 Structures Structures can be created dynamically by direct assignment to individual fields. array_name(index).field_name = field_value An 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 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 can be created and %assigned dynamically. Clue.who = 'Prof Plum'; Clue.where = 'Study'; Clue.what = 'Candlestick'; disp(Clue) who: 'Prof Plum' where: 'Study' what: '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).who = 'Ms. Scarlet'; Clue(2).where = 'Library'; Clue(2).what = 'Rope'; disp(Clue(2)) who: 'Ms. Scarlet' where: 'Library' what: '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 1 st in record #2 who: 'Ms. Scarlet' where: 'Library' what: 'Rope' turns: 15

Adding Fields %Adding new fields will cause a 'null' field in the %cells already defined. disp(Clue(1)) who: 'Prof Plum' where: 'Study' what: 'Candlestick' turns: [] %turns was not defined originally

The Array Function: struct() %All fields (a complete record) can be assigned with one %statement. 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 Mustard' where: 'kitchen' what: 'revolver' turns: 22

Using Array Functions What does this code segment do? Clue(1).turns = 17; avg_turns=sum([Clue.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, sum, 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(avg_turns) 18

Try This! 1. Use MATLAB to create a structure similar to the Clue Game Database in the examples. 2. Try these commands in MATLABcommands Clue.whoClue {Clue.who}Clue(3).turns [Clue.who][Clue.where] char(Clue.who)Clue(2).who 3. Notice the different ways that the same data are presented. See a list of structure related function in Table on page 120 of the text.

RAT 7.1 Take out a piece of paper, write your name, team#, today’s 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 don’t 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)