Exercises 2 (to be completed using MATLAB) 1. Use a MATLAB script file to write
ID: 3767293 • Letter: E
Question
Exercises 2 (to be completed using MATLAB)
1. Use a MATLAB script file to write a program that asks the user for a 2-D matrix and
computes the average of the second column of the matrix. Use the built-in sum and size
functions to help you do this. Use the help functionality in MATLAB to learn about those
functions.
2. A biomedical experiment is being conducted only on participants whose blood pressure is
optimal. This is defined as a systolic blood pressure less than 120 and a diastolic blood pressure
less than 80. Write a script that will prompt for the systolic and diastolic blood pressures of a
person, and will print whether or not that person is a candidate for this experiment.
3. The area A of a rhombus is defined as A = d1d2/2, where d1 and d2 are the lengths of the two
diagonals. Write a script rhomb that first prompts the user for the lengths of the two diagonals. If
either is a negative number or zero, the script prints and error message. Otherwise, it calculates
the area of the rhombus and prints the result.
4. The continuity equation in fluid dynamics for steady fluid flow through a stream tube equates
the product of the density, velocity, and area at two points that have varying cross-sectional areas.
For incompressible flow, the densities are constant so the equation is A1V1 = A2V2. If the areas
and V1 are known, V2 can be found as A1V1/A2. Write a script that will prompt the user for the
two areas in square feet, and will print whether the velocity at the second point will increase,
decrease, or remain the same as at the first point.
5. Write a script that will generate one random integer and will print whether the random integer
is an even or an odd number. (Hint: an even number is divisible by 2; so check the remainder
after dividing by 2.)
Explanation / Answer
can help u with this one
5
ranInt = randi([1, 100]);
if rem(ranInt,2) == 0
fprintf( '%d is even ' , ranInt)
else
fprintf( '%d is odd ' , ranInt)
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.