Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help solving Using Matlab Write a function with the header: function (Q) = myIsprime(M) Which takes a 2-D matrix M as input and returns
Please help solving Using Matlab
Write a function with the header: function (Q) = myIsprime(M) Which takes a 2-D matrix M as input and returns a matrix Q of the same size with a 'P' in every position where M has a prime number, and an 'X' in every position where M has a non-prime number. Please use nested for-loops to cycle through members of M You may use built-in function isprime to evaluate each element of M. Test Cases: >> M = [2 15 12 6 ; 7 12 18 8 ; 5 1 9 2 ; 12 9 12 0] M = >> myIsprime (M) ans = PXXX PXXX PXXP XXXX >> M = [115 144 50 152 ; 93 142 20 53 ; 157 162 56 132 ; 34 40 43 158] M =Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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