Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a function with the header: function Q = myTrigFunction(M) which takes a Matrix M filled with integers and returns a matrix Q such that
Write a function with the header: function Q = myTrigFunction(M) which takes a Matrix M filled with integers and returns a matrix Q such that Q(i,j) = sin(pi/M(i,j)) + 1 if M(i,j) is an odd integer and Q(i,j) = cos(pi/M(i,j)) 1 if M(i,j) is an even integer. You may assume elements of M will be greater than 0.
Problem 4: (5 Points) Write a function with the header: function myTrigFunction (M) which takes a Matrix M filled with integers and returns a matrix Q such that 0(i,j) = sin(pi/M (i,j)) + 1 0(i,j) = cos (pi/M ( i, j ) ) -1 if M(i,j) is an odd integer and if M(i,j) is an even integer. You may assume elements of M will be greater than O Test Cases: >> A = [3 4; 6 7]; >> R = myTrigFunction(A) 1.8660 0 -0.1340 0.2929 1.4339 >> B = [41 3 5 8 12 16 1 106 9; 2 5 12 3 14 17 33 19 11]; >> S myTrigFunction (B) 1.0765 1.8660 1.5878 0.0761-0.0341-0.0192 1.0000 0.0004 1.3420 1.0000 1.5878 -0.0341 1.8660 0 0.0251 1.1837 1.0951 1.1646 1.2817Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started