Question: HW6P4 (25 points) a) (10 pts) Modify your program HW6P3.m to HW6P4a.m that uses a while loop which terminates once E 20 instead of the

 HW6P4 (25 points) a) (10 pts) Modify your program HW6P3.m to

HW6P4 (25 points) a) (10 pts) Modify your program HW6P3.m to HW6P4a.m that uses a while loop which terminates once E 20 instead of the for loop. Review the sample problem of the infinite sum for e* in your notes for Week6 (pages 18-19). You must notice that the while loop in this problem does not need a break command. Everything else will be the same as in HW6P3. Test your program on the same values of HW6P3 (a-d) b) (15 pts) Modify your program HW6P4a.m to HW6P4b.m that works not only for scalars but also for any vector or 2D matrix. You will need to nest your while loop for HW6P4a.m inside 2 other for loops, one for each matrix dimension. One of the 2 for loops will be nested in the other. Your program must determine the dimensions m and n of the input array and preallocate a matrix Root3 (m,n) of the same size using the zeros function as in HW6P1. For every value of the input matrix P(i,j), the program must determine its cubic root as before and then save it in Root3 (i,j) such that at the end of the program Root3 will be similar to P. (1/3) . The output must be displayed as: The Cubic Root of the Input Matrix is: Use the disp function to display the text and the values in Root3. Test your program on the following arrays: 1) B-[1 8 27 64 125] 2) E 1 8 27 64125; 864 216 512 1000] HW6P4 (25 points) a) (10 pts) Modify your program HW6P3.m to HW6P4a.m that uses a while loop which terminates once E 20 instead of the for loop. Review the sample problem of the infinite sum for e* in your notes for Week6 (pages 18-19). You must notice that the while loop in this problem does not need a break command. Everything else will be the same as in HW6P3. Test your program on the same values of HW6P3 (a-d) b) (15 pts) Modify your program HW6P4a.m to HW6P4b.m that works not only for scalars but also for any vector or 2D matrix. You will need to nest your while loop for HW6P4a.m inside 2 other for loops, one for each matrix dimension. One of the 2 for loops will be nested in the other. Your program must determine the dimensions m and n of the input array and preallocate a matrix Root3 (m,n) of the same size using the zeros function as in HW6P1. For every value of the input matrix P(i,j), the program must determine its cubic root as before and then save it in Root3 (i,j) such that at the end of the program Root3 will be similar to P. (1/3) . The output must be displayed as: The Cubic Root of the Input Matrix is: Use the disp function to display the text and the values in Root3. Test your program on the following arrays: 1) B-[1 8 27 64 125] 2) E 1 8 27 64125; 864 216 512 1000]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!