Question: MATLab 4,5,6 please im 4. Write a function with header (M1, M2] = mySplitMatrix(M), where M is a matrix, M1 is the left half of



im 4. Write a function with header (M1, M2] = mySplitMatrix(M), where M is a matrix, M1 is the left half of M, and M2 is the right half of M. In the case where there is an odd number of columns, the middle column should go to M1. Hint: The size and cell functions will be useful for this. Assume that Mhas at least two columns. Test Cases: >> M = [1 2 3; 4 5 6; 7 8 9) M= 1 2 3 4 5 6 7 8 9 >> [M1, M2] = mySplitMatrix (M) M1 = 1 2 4 5 7 8 M2 3 6 9 CO UN = 0 Download : Download full-size image >> m = ones (5,5); >> [ml, m2] mySplit Matrix (m) ml 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 m2 = 1 1 1 1 1 1 1 1 1 1 Download : Download full-size image 1m 5. Write a function with header (S,V] = myCylinder(r,h), where r and h are the radius and height of a cylinder, respectively, and S and V are the surface area and volume of the same cylinder, respectively. Recall that the surface area of a cylinder is 27r2 + 2 th, and the volume is prh. Assume that r and h are 1 x 1 doubles. Test Cases: >> [S,V] myCylinder (1,5) S- 37.6991 V- 15.7080 >> [S,V] = myCylinder (2,3) S 62.8319 V- 37.6991 Download : Download full-size image m 6. Write a function with header [N] = myNOdds (A), where A is a one-dimensional array of doubles and N is the number of odd numbers in A. Test Cases: >> nl myNOdds ((1:100 FEEDBACK Im 6. Write a function with header [N] myNOdds (A), where A is a one-dimensional array of doubles and N is the number of odd numbers in A. Test Cases: >> nl = myNodds ((1:100]) nl = 50 >> n2 = myNOdds ([2:2:1001) n2 = 0 Download : Download full-size image
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
