4 Pages

lecture29bw

Course: ENGLISH 7, Spring 2009
School: Berkeley
Rating:
 
 
 
 
 

Word Count: 823

Document Preview

29 Procedural LECTURE Programming The design focuses on steps that must be executed executed to achieve a desired state. One typically represents data as individual variables or fields of a structure and implement operations as functions that take the variables as arguments. Programs usually call a sequence of functions, each one of which is passed data, each and then returns modified data. Each function...

Register Now

Unformatted Document Excerpt

Coursehero >> California >> Berkeley >> ENGLISH 7

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
29 Procedural LECTURE Programming The design focuses on steps that must be executed executed to achieve a desired state. One typically represents data as individual variables or fields of a structure and implement operations as functions that take the variables as arguments. Programs usually call a sequence of functions, each one of which is passed data, each and then returns modified data. Each function performs an operation or perhaps many operations on the data. 1 2 Object-Oriented Programming Classes & Objects E7, Fall 2008, M. Frenklach Object-Oriented Design Object-Oriented Design A class describes a set of objects with common characteristics. Objects are specific instances of a class. The values contained in an objects properties are what make an object different from other objects of the same class class. The functions defined by the class (called methods) are what implement object th behaviors that are common to all objects of a class (you can add two doubles regardless of their values). 4 defines objects, that: organize (systematize) data define methods (functions) link data and methods protect data hide implementation (complexity) 3 properties class: automobile automobile color design weight move stop accelerate properties object: Honda Civic >> x = 5 x= 5 >> class(x) class(x) ans = double >> methods(x) Methods for class double: abs accumarray acos acosh all amd and any asin asin asinh atan atan2 atanh balance bitand bitcmp bitget bitor bitset bitshift bitshift bitxor bsxfun ceil chol cholinc cholupdate colon conj contourc conv2 cos cosh cosh ctranspose cumprod cumsum delete det diag diff display dmperm eig eps eps eq exist exp fft fftn fftw filter filt find finite fix floor full full ge gt hess hypot ifft ifftn ilu imag inv isfinite isinf isinf isnan issorted jit_breakpoint ldivide ldl le linsolve li log log2 logical lt ltitr ltitr lu luinc max mimofr min minus mldivide mod mpower mrdivide mtimes mtimes ne nnz nonzeros norm not nzmax or ordeig ordqz ordschur permute plus plus pow2 power prod qr qrupdate qz rcond rdivide real reallog realpow realpow realsqrt rem reshape round schur sign sin sinh sort sparse sparsfun sqrt sqrt sum superiorfloat svd tan tanh times transpose tril triu trmginput uminus uminus uplus xor methods red 4-door sedan sedan 1255 kg 5 6 radar.m %% create a conversion function: degrees -> radians deg2rad = @(degrees) degrees * pi / 180; %% set the initial geometry points = [1 -1 -1 1 [1 1 1 -1 -1]; %% set the rotation angle and convert it to radians angle = -1; phi = deg2rad(angle); %% execute rotation newPoints = rotate_array(phi,points); %% execute rotation w = 1; set(gcf,'KeyPressFcn','w = 0'); while w points = rotate_array(phi,points); rotate_array.m drawnow plot_points(points) function newPoints = rotate_array(phi,points) end % newPoints = rotation6(angle in radians,points) % rotation of coordinate axes rotationMatrix = [ cos(phi) -sin(phi) sin(phi) cos(phi) ]; cos(phi) ]; newPoints = rotationMatrix * points; classdef Untitled %UNTITLED Summary of this class goes here % Detailed explanation goes here properties end methods end end plot_points.m function plot_points(points) % plot points given their coordinates plot points given their coordinates fill(points(1,:), points(2,:),'r') axis([-2 2 -2 2]) axis equal 8 classdef radar % E7, Fall 2008, M. Frenklach properties Points = []; Color = ''; Direction = []; % +1 or -1 [] Phi = []; % in degrees Delay = []; end methods function obj = radar(p,c,d,angle,del) radar(p obj.Points = p; obj.Color = c; obj.Direction = d; obj.Phi = angle; obj.Delay = del; del; end 9 ... %% set the initial geometry clear classes,clc points = [1 -1 -1 1 [1 1 1 -1 -1]; %% create a new radar object myRadar = radar(points,'r',1,10,0.5); >> properties(myRadar) Properties for class radar: Points Color Direction Phi Delay >> methods(myRadar) Methods for class radar: plot radar rotate rotate1 10 % Positioning a radar %% set the initial geometry clear classes,clc classes points = [1 -1 -1 1 1 1 -1 -1]; %% create a new radar object myRadar = radar(points,'r',1,10,0.5); %% rotate myRadar.rotate Protecting Data classdef radar2 % E7, Fall 2008, M. Frenklach properties Color Direction Phi Delay end = = = = ''; []; []; []; % +1 or -1 % in degrees properties (SetAccess = 'private') Points = []; []; end methods 12 function obj = radar2(p,c,d,angle,del) 11 Setting Public Property >> myRadar.Color ans = r >> myRadar.Color = 'b' myRadar = radar2 properties: Color: 'b' Direction: 1 Phi: 10 Delay: 0.5 Points: [2x4 double] list of methods 13 Setting Private Property >> myRadar.Points ans = 1 -1 -1 1 1 -1 1 -1 >> myRadar.Points = [-1 1 1 -1; 1 1 -1 -1] ??? Setting the 'Points' property of the th 'P th 'radar2' class is not allowed. 14 function y = plus(obj1,obj2) for r = obj1.Reaction if ~isempty(r.with) && ... strcmpi(r.with.Formula,obj2.Formula) y = r.make; return end y = []; end end function display(b) name = [b.Formula ' ' b.Name]; if isempty(b.Image) disp(name) else figure('NumberTitle', 'off',... 'Resize','off',... 'MenuBar', 'none',... 'Color','white',... 'Name', name); imagesc(b.Image); set(gca,'Position',[0 0 1 1]); colormap(gray(2)); axis image off end end Summary: What did we learned today? CLASS: defines objects Attributes and behavior Method Overload OBJECT Properties internal variables Methods functions, method overload Events (we did not talked about it) EXAMPLE: class radar 15 16
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Berkeley - ENGLISH - 7
University of California, Berkeley Fall Semester 2005College of Engineering Professor R. Dibble and R. HorowitzE77 Midterm Examination IMonday September 26, 2005 Name : SID :Section:12(Please circle your lecture section)Please circle your Laborato
Berkeley - ENGLISH - 7
Page 2 Part A (10 points)Name:A.1 (3 points) Complete the following MATLAB function, called currency conv. function Aout=currency_conv(Ain,Tin,Tout) % The function converts money from one currency to % another. % Ain : input amount % Tin : input currenc
Berkeley - ENGLISH - 7
Berkeley - ENGLISH - 7
Two worlds on a stringInstead of giving the whole solution, here I'll just add some explanation to this problem since the hints of this problem already set up all the steps needed. As the picture indicated, we can separate the motion of the two balls to
Berkeley - ENGLISH - 7
Problem 10.40 Since the net external torque is zero, the angular momentum is conserved L0 = L f . That is, I 00 = I f f . Since f is given (0.40 rev/s), we only need to calculate I 0 and I f , by considering that the total moment of inertia I is the sum o
Berkeley - ENGLISH - 7
Berkeley - ENGLISH - 7
StrainStressStressStrain
Berkeley - ENGLISH - 7
A .'*. l"nL h+ ^,trt .\,"i"5.f'. rst\l\+j ovr ' l * 9 5 . 6 \ * ; q " . '/ /ts-"illiE+^* rrR'A,u,-Adnvr = 3rvj= .(1F u" r%""i(r-*T)=zsud V = cfw_"v^ = /, db.l+ql.'^ c"+",i,t7 tn< acfw_-.\ ^&t.l 3'^q !.!^+ k acd.e.i)*"0" . XogV.t,a\=:& 16
Berkeley - ENGLISH - 7
Problem 13.50 Solution This is a physical pendulum. Since it takes 120s to complete 100 swings. Period is T = 120s/100 = 1.2s Use the formula (14-14), replace h by d, the distance from center of gravity to pivot point, T = 2 I mgdWe can solve for moment
Berkeley - ENGLISH - 7
DeVry Houston - MATH - Math 221
MAT 167: Statistics Final Exam Instructor: Anthony Tanbakuchi Summer 2008Name: Computer / Seat Number:No books, notes, or friends. Show your work. You may use the attached equation sheet, R, and a calculator. No other materials. Show your work in the sp
DeVry Houston - MATH - Math 221
SOLUTIONS MAT 167: Statistics Final Exam Instructor: Anthony Tanbakuchi Spring 2008Name: Computer / Seat Number:No books, notes, or friends. Show your work. You may use the attached equation sheet, R, and a calculator. No other materials. If you choose
DeVry Houston - MATH - Math 221
MATH 221, Term 1004MATH 221-Statistics For Decision MakingDeVry University, Term 1004Professor: Susan Sun Nunamaker; phone: (630) 652-8268; Email:susan@nunamaker.com; web page: <mathlady.org> ASC/office hours: Tues. (1:00-2:00P.M., 3:00-3:50P.M ); Wed.
DeVry Houston - MATH - Math 221
Use Social Media to Grow Your Business!BrowardSCORE September 2009Agenda What is social media? Why should I use social media? What are the leading social media tools and how do I use them? How do I use social media to grow my business?15 September 200
DeVry Houston - MATH - Math 221
HOSTED EXCHANGEHOSTED EXCHANGEUpgrade to Hosted Email, Calendaring, and Collaboration While email has become mission-critical, the cost and resources required to maintain a secure and reliable email system continues to climb. Until now, most growing bus
DeVry Houston - MATH - Math 221
Hosted ExchangeXO Hosted ExchangeXO Hosted Exchange Whitepaper Copyright 2008. XO Communications, LLC. All rights reserved. XO, the XO design logo, and all related marks are trademarks of XO Communications, LLC. All other trademarks are property of the
DeVry Houston - MATH - Math 221
XO HOSTED IT SERVICES - RELIABLE. SCALABLE. SECUREHOSTED IT SERVICESEnterprise-class solutions to streamline IT management, improve security and uptime, and reduce costs for small to medium size organizations.Web Hosting XO Clustered Technology is desi
DeVry Houston - MATH - Math 221
XO MANAGED SERVERMANAGED SERVERXO Managed Server is an enterprise-class, highly available, and fully managed hosting solution designed for small and medium sized enterprises (SME). Built on XOs Cloud Computing Platform, Managed Server offers both Window
DeVry Houston - MATH - Math 221
PERIMETER EMAIL PROTECTIONPERIMETER EMAIL PROTECTION (PEP)Perimeter Email Protection (PEP) is an email security solution that can protect your business from spam, viruses, directory harvesting, denial-of-service, fraud, phishing schemes, and other debil
UConn - OPIM - 3103
Housing Office Revenue ProjectionResidence HallsDouglass Taravella Stuyvesant Tilden Clinton Madison Totals Assumption Area Price of a Double Room (per student) Price of a Single Room Meal Plan Cost Your Name Goes HereNumber of Double Rooms250 240 375
UConn - OPIM - 3103
Proposal for Dream HomeKenneth and Anita Arnold Base Home Estimated square footage Base price per square foot Base price Interior upgrades Kitchen cabinets (oak) Lighting fixtures Carpeting and tile Fireplace Exterior upgrades Brick driveway Swimming poo
UConn - OPIM - 3103
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28A B C D E Transylvania College Radiology Department Payroll Name Hourly Wage Regular Hours Overtime Hours Dwyer 8 40 8 Smith 7.2 40 8 Brown 8 40 10 Look 9 35 0 Thomas 9.2 40 0 Gonz
UConn - OPIM - 3103
West Transylvania Athletics Grade Book - Final Semester Averages Test Average 76.3 95.3 76.8 63.8 86.5 85.0 57.3 76.3 87.5 74.8 80.8 89.0 79.3 63.8 HW BonusName Albert, Eddy Thomas, Frank Jones, Theodore Fagan, Samuel Dicks, Starr Frampton, Judy Marie, T
UConn - OPIM - 3103
The Election of 2004 Bush Popular Vote Electoral Vote Poll worker: Jeff Hauschild State ALABAMA ALASKA ARIZONA ARKANSAS CALIFORNIA COLORADO CONNECTICUT DELAWARE DISTRICT OF COLUMBIA FLORIDA GEORGIA HAWAII IDAHO ILLINOIS INDIANA IOWA KANSAS KENTUCKY LOUISI
UConn - OPIM - 3103
WordProcessingMilwaukee Buffalo Harrisburg Pittsburgh TotalSheet1Transylvania Software SalesWord Processing Spreadsheets Database Total Milwaukee Buffalo Harrisburg Pittsburgh Total $50,000.00 $67,500.00 $200,000.00 $141,000.00 $458,500.00 $44,000.00
UConn - OPIM - 3103
Transylvania SoftwareMiami, FloridaTo: From: Subject:Mr. White Chairman, Transylvania Software Heather Bond Vice President, Marketing May Sales DataThe May sales data clearly indicate that Pittsburgh is outperforming our other geographic areas. It is
UConn - OPIM - 3103
DataModelingClicktoeditMastersubtitlestyle OPIM3103Section1 Fall2009 DmitryZhdanov11/2/09Topicsfortoday Moredetailsonkeys Basicdatamodelingnotation DrawingEntityRelationshipdiagrams11/2/09Processofdatamodeling Identifybusinessrequirementsfortheda
UConn - OPIM - 3103
DatabaseNormalizationOPIM3103,Fall2009 ClicktoeditMastersubtitlestyle DmitryZhdanov11/2/09Topicsfortoday Whynormalize? Modificationanomaliesindatabases Datadependencies Normalizationprocess11/2/09WhatisNormalization?Normalizationistheprocessofdeco
Indiana - PHYS - 201
MasteringPhysics: Assignment Print ViewPage 1 of 13Assignment Display Mode: View Printable AnswersIUPhysicsP201F2009Assignment09aDue at 11:00pm on Tuesday, October 28, 2008View Grading DetailsTorques on a Seesaw: A TutorialDescription: Balancing s
Cornell - BIO - 3110
Lec6- 2009INTRODUCTORY ANIMAL PHYSIOLOGY BIOAP3110/BIOMS3110/VTBMS3460 FALL 2009 OUTLINE - LECTURE 6 Osmosis and Water 'Transport' (Reading - Chapter 4 pp. 51-52, Chapter 25 pp.296-301) I. 1. 2. 3. 4. II. Major Topics/Concepts to be covered: Colligative
Cornell - BIO - 3110
Lec 5- 2009INTRODUCTORY ANIMAL PHYSIOLOGY BIOAP3110/BIOMS3110/VTBMS3460 FALL 2009 OUTLINE - LECTURE 5 Diffusion and Transport (readings - Chapter 4, pp45-51 (excluding osmosis); 52-56) I. Major Topics/Concepts to be covered: 1. 2. 3. 4. 5. 6. II. Diffusi
Cornell - BIO - 3110
Lec4- 2009INTRODUCTORY ANIMAL PHYSIOLOGY BIOAP3110/BIOMS3110/VTBMS3460 FALL 2009 OUTLINE - LECTURE 4 Energy, Gradients and the 2nd Law of ThermodynamicsI.Major Topics/Concepts to be covered: 1. 2. 3. 4. The need for energy to maintain biological struct
Cornell - BIO - 3110
Lec3 - 2009INTRODUCTORY ANIMAL PHYSIOLOGY BIOAP 3110/BIOMS3110/VTBMS3460 FALL 2009 OUTLINE - LECTURE 3 Temperature Regulation(readings - Chapter 73, pp.889-901) I. 1. 2. 3. 4. 5. II. 1. 2. 3. Major Topics/Concepts to be covered: Requirements for thermor
Cornell - BIO - 3110
Lecs1&2 - 2009INTRODUCTORY ANIMAL PHYSIOLOGY BIOAP3110/BIOMS3110/VTBMS3460 FALL 2009 OUTLINE - LECTURES 1 & 2 Physiological Systems/Homeostasis/Regulatory Systems/Information Pathways (readings - Chap. 1, general pp. 4-8) I. Major Topics/Concepts to be c
Cornell - BIO - 3110
Membrane Potential Cheat SheetPNa+ [Na+out] PK+ [K+out] [K+out] [Ca+out] [Ca+out] PCa+ PCa+DepolarizeHyperpolarize PNa+ [Na+out] PK+1. P = permeability. 2. Assume that Cl- is at equilibrium with ECl- equal to the membrane potential. In other words, it
Cornell - BIO - 3110
INTRODUCTORY ANIMAL PHYSIOLOGY BIOAP3110/BIOMS3110/VTBMS3460 Fall 2009 PRELIM 2 SAMPLE EXAM1.Which of the following would you expect to have the lowest threshold for excitation? A SA node B AV nodeThe following 5 questions refer to the figure below.A
Cornell - BIO - 3110
INTRODUCTORY ANIMAL PHYSIOLOGY BIOAP3110/BIOMS3110/VTBMS3460 Fall 2009SAMPLE PRELIM I1. Which of the following variables is most likely NOT under negative feedback control. a. b. c. d. Blood calcium concentration. The rate of insulin release from pancre
Cornell - BIO - 3110
Skeletal MuscleTypes of Contraction: 1. Isotonic the muscle contracts developing tension so that the muscle shortens as the attachment points (origin and insertion) are brought together. Energy is expended as myosin and actin slide past one another. Exam
Cornell - BIO - 3110
Smooth Muscle Contraction Cheat SheetSkeletal muscle contraction initiated by calcium binding to troponin complex of actin. Smooth muscle contraction initiated by calcium-regulated phosphorylation of myosin. Given: 1. 2. 3. 4. Actin as in skeletal muscle
Cornell - BIO - 3110
Skeletal Muscle Energy Cycle Cheat SheetGiven: 1. High concentration of ATP in muscle fiber. 2. Very low free Ca+ - actin binding sites blocked so no actin/myosin bonding possible State: The binding sites for ATP on the myosin head group are filled and t
University of Phoenix - ACC 537 - ACC 537
Week 2 QuizUse the following information to answer questions 15: Sams Office Supplies Balance Sheet December 31, 2008 Cash $ 65,000 Prepaid Insurance 30,000 Accounts Receivable 50,000 Inventory 70,000 Land held for investment 75,000 Land 90,000 Building
Phoenix - MATH 117 - MATH 117
Axia College MaterialAppendix F Ticket SalesLiving in or near a metropolitan area has some advantages. Entertainment opportunities are almost endless in a major city. Events occur almost every night, from sporting events to the symphony. Tickets to thes
University of Texas - BIO - 311C
Bio311C Exam 1: Practice QuestionsTrue/False. For each of the following, determine if the statement is true or false. If true, write true. If false, correct the statement or explain why it is false. C H and O H are both nonpolar covalent bonds. The pH of
University of Texas - BIO - 311C
Bio311C Exam 2: Practice QuestionsMultiple Choice.G = a. b. c. d. e. H-T S H+T S H- S H+T S H-T SThe hydrolysis of starch to glucose is a spontaneous reaction. However if you dissolve starch in water and keep the solution overnight at room temperature
University of Texas - BIO - 311C
Bio311C Exam 1: Review Checklist Wednesday, September 23Chapter 1: pages 1-20 (7th edition: pages 2-16, 19-21, 26-27) Life Characteristics of life Biological Themes New properties emerge at each level in the biological hierarchy Biological hierarchy Emer
University of Texas - BIO - 311C
Bio311C Exam 2: Review Checklist Wednesday, October 21Chapter 6: pages 94, 98-122 (7th edition: pages 92-121) Cell theory Common features of all cells Plasma membrane Cytosol and cytoplasm DNA Ribosomes Energy and nutrient acquisition (see below: chapter
University of Texas - BIO - 311C
Introduction:Themes in the Study of LifeBiologyLifeFig. 1-3OrderResponse to the environment Evolutionary adaptationRegulation Energy processing Reproduction Growth and developmentNew properties emerge at each level of the biological hierarchyBios
University of Texas - BIO - 311C
The Chemical Context of LifeOrganisms are composed of matter Matter ElementPeriodic Table of the ElementsEssential elementsAtoms Composed of subatomic particlesAtomic modelsAtoms Atomic Number Mass NumberIsotopesElectron distribution Electro
University of Texas - BIO - 311C
WaterWater molecules are polarWater molecules are polar + + +Hydrogen bonds+Emergent Properties of Water Cohesion Moderates temperature Expands upon freezing The Solvent of LifeWater is Cohesive CohesionWater is CohesiveAdhesionCohesionWater
University of Texas - BIO - 311C
Carbon & Organic CompoundsOrganic Chemistry Organic compoundsCarbonVersatility of Carbon BondingName (a) Methane Molecular Formula Structural Formula Ball-and-Stick Model Space-Filling Model(b) Ethane(c) Ethene (ethylene)Versatility of Carbon Bond
University of Texas - BIO - 311C
The Structure and Function of Large Biological MoleculesMacromolecules Four main classes of large biological moleculesMacromolecules Polymer MonomerMaking and Breaking PolymersMaking PolymersHO123HHOHShort polymer Dehydration removes a water
University of Texas - BIO - 311C
Lipids Functions Types Triglycerides Phospholipids SteroidsTriglycerides Functions StructureTriglycerides: StructureFig. 5-11aFatty acid (palmitic acid) Glycerol (a) Dehydration reaction in the synthesis of a fatTriglycerides: StructureEster link
University of Texas - BIO - 311C
NAME_ Discussion Worksheet #3 MacromoleculesBIO 311C1. Name of the chemical reaction that breaks a polymer down to its individual monomers: _ 2. Name of the chemical reaction used to build polymers by joining individual monomers together: _ 3. Name the
University of Texas - BIO - 311C
NAME _ Discussion Worksheet #1 The Chemical Context of LifeBIO 311C F091. An atom consists of a nucleus, and an outer part called the electron cloud. The nucleus contains _ and _. 2. Fill in the charge for each type of subatomic particle: a. Proton _ b.
University of Texas - BIO - 311C
NAME _ Discussion Worksheet #2 Water & Organic ChemistryBIO 311C1. What is the maximum number of hydrogen bonds a water molecule can form? _2. If the temperature of a body of water increases, what happens to the hydrogen bonds between the water molecul
University of Texas - BIO - 311C
NAME_KEY_ Discussion Worksheet #3 MacromoleculesBIO 311C1. Name of the chemical reaction that breaks a polymer down to its individual monomers. Hydrolysis 2. Name of the chemical reaction used to build polymers by joining individual monomers together.De
University of Texas - BIO - 311C
Name _ Discussion Worksheet #4 Cell & Cell Structure ReviewBio 311CMatch each term below to the following descriptions. Terms may be used once, more than once, or not at all.a. Mitochondria f. Ribosome k. Nucleoid p. Chloroplastb. Rough ER g. Lysosome
University of Texas - BIO - 311C
Name _ Discussion Worksheet #4 Cells & Cell Structure ReviewBio 311C F09Match each term below to the following descriptions. Terms may be used once, more than once, or not at all. a. Mitochondria f. Ribosome k. Nucleoid p. Chloroplast b. Rough ER g. Lys
University of Texas - BIO - 311C
NAME _ Discussion Worksheet #5 Cytoskeleton and Extracellular Components 1. List the three components of the cytoskeleton. What is the subunit used to build each?Bio 311C2a. Describe the structure common to both cilia and flagella.2b. Describe two majo
University of Texas - BIO - 311C
NAME _KEY_ Discussion Worksheet #5 Cytoskeleton and Extracellular Components 1. List the three components of the cytoskeleton. What is the subunit used to build each? Microtubules: tubulin heterodimer Micrfilaments: actin monomer Intermediate filaments: s
University of Texas - BIO - 311C
NAME _ Discussion Worksheet #6 Cell Membrane Structure & FunctionBio 311C1a. Describe the Fluid Mosaic Model of membrane structure.1b. Compare integral membrane proteins and peripheral membrane proteins.2. What is the main function of membrane glycopr