
Concept explainers
Answer the question with each of the following code segments. If an error will occur, write ERROR and explain what caused the error.
a. What is stored in Count by the following code?
b. What is displayed on the screen by the following code?
c. What is displayed on the screen by the following code?
d. What is stored in P and C after the following code executes?
a.

What variable is stored in Count.
Answer to Problem 1ICA
The variable stored in Count is 8.
Explanation of Solution
Given data:
Count =0;
for N=10:-0.2:8.5;
Count=Count+1;
end
Program execution:
Steps to execute the MATLAB program:
- 1. Open the command window and paste the given program.
- 2. Press enter.
- 3. Output is displayed in command window.
Enter Count in the command window and execute the program.
>> Count
Count =
8
Conclusion:
Thus, the variable stored in Count is 8.
b.

What is displayed on the screen after executing the given program.
Answer to Problem 1ICA
The output displayed on the screen:
6
12
20
30
42
56
Explanation of Solution
Given data:
for m=3:8
fprintf('%0.0f\n',m^2-m)
end
Program execution:
Steps to execute the MATLAB program:
- 1. Open the command window and paste the given program.
- 2. Press enter.
- 3. Output is displayed in command window.
MATLAB Output after execution of program is displayed as follows.
6
12
20
30
42
56
Conclusion:
Thus, the Output displayed on the screen:
6
12
20
30
42
56
c.

What is displayed on the screen after executing the given program.
Answer to Problem 1ICA
The output displayed in the screen is 56.
Explanation of Solution
Given data:
for m=3:8;
M2=m^2-m;
end
fprintf('%0.0f\n',M2)
Program execution:
Steps to execute the MATLAB program:
- 1. Open the command window and paste the given program.
- 2. Press enter.
- 3. Output is displayed in command window.
MATLAB Output after execution of program is displayed as follows.
56
Conclusion:
Thus, the output displayed in the screen is 56.
d.

What variables are stored in p and C.
Answer to Problem 1ICA
The variables stored in in p and C are p=945 and C=4.
Explanation of Solution
Given data:
S=3;
I=2;
P=1;
C=0;
for K=S:I:S^I
P=P*K;
C=C+1;
end
Program execution:
Steps to execute the MATLAB program:
- 1. Open the command window and paste the given program.
- 2. Press enter.
- 3. Output is displayed in command window.
Enter P and C in the command window and execute the program.
>> P
P =
945
>> C
C =
4
Conclusion:
Thus, the variables stored in in p and C are p=945 and C=4.
Want to see more full solutions like this?
Chapter 20 Solutions
Thinking Like an Engineer: An Active Learning Approach (3rd Edition)
- Air at T₁-24°C, p₁-1 bar, 50% relative humidity enters an insulated chamber operating at steady state with a mass flow rate of 3 kg/min and mixes with a saturated moist air stream entering at T₂-7°C, p2-1 bar. A single mixed stream exits at T3-17°C, p3-1 bar. Neglect kinetic and potential energy effects Step 1 Your answer is correct. Determine mass flow rate of the moist air entering at state 2, in kg/min. m2 = 2.1 Hint kg/min Using multiple attempts will impact your score. 5% score reduction after attempt 2 Step 2 Determine the relative humidity of the exiting stream. Փ3 = i % Attempts: 1 of 3 usedarrow_forward25 mm Brass core E = 105 GPa 0 = 20.9 x 10 °C PROBLEM 2.49 The aluminum shell is fully bonded to the brass core and the assembly is unstressed at a temperature of 15°C. Considering only axial deformations, determine the stress in the aluminum when the temperature reaches 195°C. 60 mm Aluminum shell E = 70 GPa a = 23.6 × 10°Carrow_forwardThis is an old practice exam. The answers are OAB = 19.10 ksi OBC = 2.228 ksi OCD = −2.865 ksi v = 0.2792delta Ltot = 0.01585 in (increase) but whyarrow_forward
- A random poly(styrene-butadiene) copoly- mer has a number-average molecular weight of 350,000 g/mol and a degree of polymerization of 5000. Compute the fraction of styrene and buta- diene repeat units in this copolymer. H H | | -C-C- 방 Harrow_forwardDesign and assemble on the fluidsim (or a draft) the Hydraulic Drive Circuit, with the following characteristics: (a) Sequential operation, pressure, for the advance and return of the cylinders (according to the proper operation for the device) controlled by a directional 4x3 way, closed center; (b) Speed control for the cylinders, according to the load signal; (c) Pressure counterbalance for cylinder A, in order to compensate for the weight of the assembly.arrow_forwardThis is an old exam practice question. The answer is Pmax = 218.8 kN normal stress governs but why?arrow_forward
- Moist air initially at T₁ = 140°C, p₁ = 4 bar, and p₁ = 50% is contained in a 2.0-m³ closed, rigid tank. The tank contents are cooled to T₂ 35°C. Step 1 Determine the temperature at which condensation begins, in °C.arrow_forwardAir at T₁ = 24°C, p₁ = 1 bar, 50% relative humidity enters an insulated chamber operating at steady state with a mass flow rate of 3 kg/min and mixes with a saturated moist air stream entering at T2=7°C, p₂ = 1 bar. A single mixed stream exits at T3-17°C, p3=1 bar. Neglect kinetic and potential energy effectsarrow_forwardHand calculation of cooling loadarrow_forward
- An HEV has a 24kW battery. How many miles can it go on electricity alone at 40 mph on a flat straight road with no headwind? Assume the rolling resistance factor is 0.018 and the Coefficient of Drag (aerodynamic) is 0.29 the frontal area is 2.25m^2 and the vehicle weighs 1618 kg.arrow_forwardAs shown in the figure below, moist air at T₁ = 36°C, 1 bar, and 35% relative humidity enters a heat exchanger operating at steady state with a volumetric flow rate of 10 m³/min and is cooled at constant pressure to 22°C. Ignoring kinetic and potential energy effects, determine: (a) the dew point temperature at the inlet, in °C. (b) the mass flow rate of moist air at the exit, in kg/min. (c) the relative humidity at the exit. (d) the rate of heat transfer from the moist air stream, in kW. (AV)1, T1 P₁ = 1 bar 11 = 35% 120 T₂=22°C P2 = 1 bararrow_forwardThe inside temperature of a wall in a dwelling is 19°C. If the air in the room is at 21°C, what is the maximum relative humidity, in percent, the air can have before condensation occurs on the wall?arrow_forward
- Elements Of ElectromagneticsMechanical EngineeringISBN:9780190698614Author:Sadiku, Matthew N. O.Publisher:Oxford University PressMechanics of Materials (10th Edition)Mechanical EngineeringISBN:9780134319650Author:Russell C. HibbelerPublisher:PEARSONThermodynamics: An Engineering ApproachMechanical EngineeringISBN:9781259822674Author:Yunus A. Cengel Dr., Michael A. BolesPublisher:McGraw-Hill Education
- Control Systems EngineeringMechanical EngineeringISBN:9781118170519Author:Norman S. NisePublisher:WILEYMechanics of Materials (MindTap Course List)Mechanical EngineeringISBN:9781337093347Author:Barry J. Goodno, James M. GerePublisher:Cengage LearningEngineering Mechanics: StaticsMechanical EngineeringISBN:9781118807330Author:James L. Meriam, L. G. Kraige, J. N. BoltonPublisher:WILEY





