
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
- PROBLEM 3.46 The solid cylindrical rod BC of length L = 600 mm is attached to the rigid lever AB of length a = 380 mm and to the support at C. When a 500 N force P is applied at A, design specifications require that the displacement of A not exceed 25 mm when a 500 N force P is applied at A For the material indicated determine the required diameter of the rod. Aluminium: Tall = 65 MPa, G = 27 GPa. Aarrow_forwardFind the equivalent mass of the rocker arm assembly with respect to the x coordinate. k₁ mi m2 k₁arrow_forward2. Figure below shows a U-tube manometer open at both ends and containing a column of liquid mercury of length l and specific weight y. Considering a small displacement x of the manometer meniscus from its equilibrium position (or datum), determine the equivalent spring constant associated with the restoring force. Datum Area, Aarrow_forward
- 1. The consequences of a head-on collision of two automobiles can be studied by considering the impact of the automobile on a barrier, as shown in figure below. Construct a mathematical model (i.e., draw the diagram) by considering the masses of the automobile body, engine, transmission, and suspension and the elasticity of the bumpers, radiator, sheet metal body, driveline, and engine mounts.arrow_forward3.) 15.40 – Collar B moves up at constant velocity vB = 1.5 m/s. Rod AB has length = 1.2 m. The incline is at angle = 25°. Compute an expression for the angular velocity of rod AB, ė and the velocity of end A of the rod (✓✓) as a function of v₂,1,0,0. Then compute numerical answers for ȧ & y_ with 0 = 50°.arrow_forward2.) 15.12 The assembly shown consists of the straight rod ABC which passes through and is welded to the grectangular plate DEFH. The assembly rotates about the axis AC with a constant angular velocity of 9 rad/s. Knowing that the motion when viewed from C is counterclockwise, determine the velocity and acceleration of corner F.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





