Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Matlab if-else, switch, pattern matrix output Write a function named myFunction(M,N,C) who would accept input integers M N, and a charactor c in upper case
Matlab
if-else, switch, pattern matrix output Write a function named myFunction(M,N,C) who would accept input integers M N, and a charactor c in upper case and output a M by M matrix whose elements are almost all M except on one of the four edges all N, following the rules: C="E', meaning east, right edge; c='W', left edge; c='N', upper edge; c='S', lower edge input c must be among EWNS, and your function should be able to throw an error message in the case that input c is not one of EWNS. For example: (4,2,'E') would return 4 4 4 2 4 4 4 2 4 4 4 2 4 4 4 2 (3,11,'S') would return 3 3 3 3 3 3 11 11 11 (3,11,'x') would return input x not allowed, must be one of EWNS Notes: you are going to use a lot of ones(); also, need to use the switch clause, Function 1 Code to call your function 1 myFunction (4,2, 'E')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