matlab assignment

User Generated

QNA23

Engineering

Description

Hi there I attached H.W for the mat alb assignment

for H.W 10 part A :

edit the the first line in the right

x=<( -3 ) not 3

and if u have any Q let me know

Unformatted Attachment Preview

ENGR 102 In-Class/Homework 10 Complete the following problems in a single script file. 1. Use loops to generate a fully formatted plot of the following piecewise functions on the given domain with three different colors. If the piece is a single point, use a marker to mark the point. Part A should be on one plot and Part B should be on a separate plot. Part A 3 X p(x) = ܂ 3* - 3 (x-3) x 2 Part B s(n) = (2n + 4 Inl n-2 n< -2 n = -2 n>-2 2. A miner is paid according to his hourly wage up to 40 hours, and 50% more for overtime. (So for each hour over 40 he is paid "time and a half") Write a program in a script file that calculates the pay to a worker. The program needs to ask the user to enter the number of hours and the hourly wage. The program then needs to display the pay. 3. Use Loops to create a 5X2 Matrix in which the value of each element is the sum of its row number and its column number divided by the square of its column number. For example, the value of element (3,1) is (3+1)/1^2 4. The first few terms of the Taylor series for e' are : + 2! 3! et = 1+x+ Write a MATLAB code that askes the user to enter the value of x. The first tem of the Taylor series should be called T1 and assigned the value of 1. Use a while loop to calculate the nth term of the series and add it to the sum. The program should count the number of terms, n. The while loops should run as long as the nth term is larger than 0.0001 and then number of passes is smaller than 30. The code should display the number of terms used and the value of the nth term using fprintf. 5. Vector V is given by V= 15, 17,-3,8,0,-7, 12,15, 20, -6, 6, 4,-7, 16). Write a MATLAB code that doubles the elements that are positive and are divisible by 3 or 5, and squares the elements that are negative and greater than-5. 6. The Taylor series expansion for cos(x) is: x² x cos(x) = 1 - (-1)" 2! + 6! 21 4! (20) Where x is in radians. Write a MATLAB program that determines cos(x) using the Taylor series expansion. The program should ask the user to enter a value for an angle in degrees. Then the program should use a loop for adding the terms of the Taylor series. If an is the nth term in the series, then the sum S, of the n terms is SS. 1tan, in each pass calculate the estimated error Egiven by E = ISS- Stop adding terms when Es0.000001. The program should display the value of cos(x). 7. A list of 30 exam scores is give as: 64, 49, 59, 71, 99, 89, 82, 26, 69, 19, 61, 22, 87, 36, 98, 43, 23, 55, 90, 80, 76,51, 73, 81, 88, 47,5, 92, 70, 31. Write a MATLAB code that determines how many grades are between 0 and 19, between 20 and 39, between 40 and 59, between 60 and 79, and between 80 and 100. The results should be displayed (using fprintf) in the following form: Grades between 0 and 19: XXX Students Grades between 20 and 39 XXX Students And so on.
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Here is the m-fil...


Anonymous
Goes above and beyond expectations!

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags