haihongyuan.com
海量文库 文档专家
全站搜索:
您现在的位置:首页 > 幼儿教育 > 育儿理论经验育儿理论经验

为宝宝请保姆应注意的7个注意事项

发布时间:2014-02-22 19:32:28  

ca05 review - problem solving
育儿知识 http://www.pangbaba.cc

Problem Statement #1: A cable of length l0 is needed to suspend an object of mass mobj from the ceiling. The load, T = mobjg, is the force that the mass exerts on the cable. The deflection (elongation) of the cable under the load must be less than ?lmax. Ignoring the mass of the cable (mcable, which adds to the load), what cable mass is required to just support the load without permanent deformation?

step 1: draw a sketch!!!
ceiling
l0 mobj needs l0 mobj ?lmax

T = mobjg
Engr 0012 (04-1) LecNotes 06-01

step 2: review relevant engineering
stress-strain problem: S = Ee stress strain elastic (Young’s) modulus

permanent deformation when S > Sy

looking for mass of cable

mcable ? ? V
material property look it up add to needs list
Engr 0012 (04-1) LecNotes 06-02

need equation for volume

A0
l0

step 2: review relevant engineering

V ? A0l0 ? ? d l0 / 4
2

already on needs list need equation

T S? A0
needs list l0 mobj ?lmax ? Sy
Engr 0012 (04-1) LecNotes 06-03

4T S ? 2 ?d
can calculate T = mobjg

4T d ? ?S

need value use Sy add to needs list

step 3: restate problem
Design a MATLAB script to find the minimum mass of a cable required to support an object hanging from a ceiling given the mass of the object, initial length of the cable, maximum deflection, cable density, and cable yield stress.

step 4: algorithm
1. Ask user for mass of the object, initial length of the cable, maximum deflection, cable density, and cable yield stress. 2. Compute mass of cable. 3. Report mass of cable.

Engr 0012 (04-1) LecNotes 06-04

step 5: expand step 2 of algorithm
2. Compute mass of cable. a. Compute tension.

b. Compute cable diameter. c. Compute cable volume. d. Compute cable mass.

Engr 0012 (04-1) LecNotes 06-05

ca05 review - problem solving
Problem Statement #2: My boss at the Internal Revenue Service (IRS) has asked me to develop a program that will determine how much taxes are due based upon a taxpayer’s annual salary. The tax due is based upon a provided table.

step 1: draw a sketch!!!
Can’t - not applicable.

step 2: review relevant information
Percentage Salary Range, $ Base Tax, $ on Excess, % 0 - 14,999 0 15 15,000 - 29,999 2,250 18 30,000 - 49,999 5,400 22 50,000 - 79,999 11,000 27 80,000 & above 21,600 33
Engr 0012 (04-1) LecNotes 06-06

needs list salary

Need to find where salary falls in table. Compute tax due as base + % time amount in excess of minimum in range

step 3: restate problem
Design a MATLAB script to find the tax due based upon a taxpayer’s salary.

step 4: algorithm
1. Ask user for salary. 2. Compute tax due. 3. Report tax due.

step 5: expand step 2 of algorithm
2. Compute tax due. a. Use salary and if/elseif/else structure to find appropriate row in table b. Compute appropriate excess. c. Compute appropriate tax due.
Engr 0012 (04-1) LecNotes 06-07

decision making - design issues
Whenever you need to make a decision,

make a decision table

condition
Raining Cloudy Sunny Take hat

action
Take umbrella

Take sunblock and hat

A decision table is a simple listing of conditions and actions that result if the condition is met.

Engr 0012 (04-1) LecNotes 06-08

decision making - design issues
Two types of decision conditions Mutually exclusive conditions Conditions have no overlap, i.e., only one of the conditions can be true Nonexclusive conditions Conditions can overlap, i.e., one or more of the conditions can be true at same time Example
Condition Action Raining Take umbrella Cloudy Take hat Sunny Take sunblock and hat
Engr 0012 (04-1) LecNotes 06-09

Nonexclusive - Why?

decision making - design issues
Example
Condition Score < 60 Score >= 60 Score >= 70 Score >= 80 Score >= 90 Action Earned F Earned D Earned C Earned B Earned A

Nonexclusive - Why?
score of 84 satisfies conditions 2, 3, and 4

Important because we will use an if/elseif command structure to find proper condition and action

Engr 0012 (04-1) LecNotes 06-10

if/else if/else command structure
first conditon from table if (condition 1) perform condition elseif (condition 2) perform condition elseif (condition 3) perform condition else perform “default” end if none of the conditons are met
Engr 0012 (04-1) LecNotes 06-11

first conditon actions 1 actions from table 2 actions 3 actions actions default is frequently omitted

perform these actions

decision making - MATLAB syntax
Example
Condition Score < 60 Score >= 60 Score >= 70 Score >= 80 Score >= 90 Action Earned F Earned D Earned C Earned B Earned A

if

(score < 60) grade = ?F?; elseif (score >= grade = ?D?; elseif (score >= grade = ?C?; elseif (score >= grade = ?B?; elseif (score >= grade = ?A?; end
Engr 0012 (04-1) LecNotes 06-12

60) 70) 80) 90)

MATLAB moves through structure looking for first condition that is satisfied.
MATLAB then executes the “action statements” under the condition. When the last “action statement” is finished, MATLAB goes to the end.

decision making - nonexclusive conditions
nonexclusive conditions are a problem - can either rearrange table to make sure order of execution is appropriate
Condition Score >= 90 Score >= 80 Score >= 70 Score >= 60 Score < 60 Action Earned A Earned B Earned C Earned D Earned F

note use of default rather than condition

if (score >= 90) grade = ?A?; elseif (score >= 80) grade = ?B?; elseif (score >= 70) grade = ?C?; elseif (score >= 60) grade = ?D?; else grade = ?F?; end

Engr 0012 (04-1) LecNotes 06-13

decision making - nonexclusive conditions
nonexclusive conditions are a problem - can either rearrange table to make sure order of execution is appropriate or make Condition Action conditions mutually exclusive
if (score < 60) grade = ?F?; elseif (score >= 60 & score < 70) grade = ?D?; elseif (score >= 70 & score < 80) grade = ?C?; elseif (score >= 80 & score < 90) grade = ?B?; else grade = ?A?; end
Score < 60 S

core >= 60 and Score < 70 Score >= 70 and Score < 80 Score >= 80 and Score < 90 Score >= 90 Earned F Earned D Earned C Earned B Earned A

Order of execution of mutually exclusive conditions not important because only one condition can be true

Engr 0012 (04-1) LecNotes 06-14

decision making operators comparison (relational) operators
greater than less than greater than or equal less than or equal is the same as is not the same as > < >= <= == ~=

logical (set) operators
and or not & | ~

Engr 0012 (04-1) LecNotes 06-15

example function using decision making
grade_earned.m
how do you know it is working properly?

test it!!!

Engr 0012 (04-1) LecNotes 06-16

programming assignment 03
due Wed 17 Sep

class activity 06 : ca06_e12(04-1).pdf

Engr 0012 (04-1) LecNotes 06-17


网站首页网站地图 站长统计
All rights reserved Powered by 海文库
copyright ©right 2010-2011。
文档资料库内容来自网络,如有侵犯请联系客服。zhit326@126.com