CPEG 2011 MATLAB Laboratory Spring 2022 Exercises Sheet #7 1. Use a for loop to sum the elements in the following vector

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

CPEG 2011 MATLAB Laboratory Spring 2022 Exercises Sheet #7 1. Use a for loop to sum the elements in the following vector

Post by answerhappygod »

Cpeg 2011 Matlab Laboratory Spring 2022 Exercises Sheet 7 1 Use A For Loop To Sum The Elements In The Following Vector 1
Cpeg 2011 Matlab Laboratory Spring 2022 Exercises Sheet 7 1 Use A For Loop To Sum The Elements In The Following Vector 1 (65.24 KiB) Viewed 25 times
CPEG 2011 MATLAB Laboratory Spring 2022 Exercises Sheet #7 1. Use a for loop to sum the elements in the following vector: x= [1, 33, 43, 72, 67, 56, 98, 35] Check your answer with the sum function. 2. Repeat the previous problem but by using a while loop. 3. Use a for loop to create a vector of the squares of the numbers 1 through 5. 4. Consider the following matrix of values: x = [335, 23, 17, 30, 85, 334] Use a while loop to display how many values are greater than 30? 5. The tangent (tan) of 1/2 and - 1/2 is infinity. Since MATLAB uses a floating-point approximation of it, it calculates the tangent of Tt/2 as a very large number, but not infinity Prompt the user to enter an angle between 7/2 and – Tt/2, inclusive. If it is between re/2 and - 71/2, but not equal to either of those values, calculate tan of the angle and display the result in the command window. If it is equal to r/2 or - 1/2, set the result equal to Inf and display the result in the command window. If it is outside the specified range, send the user an error message in the command window and prompt the user to enter another value. Continue prompting the user for a new value of theta until he or she enters a valid number.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply