Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please write this code in matlab. 1. [Submit on zyLabs) Write a function that has one input, a square (n x n, for any integer

image text in transcribedplease write this code in matlab.
image text in transcribed
1. [Submit on zyLabs) Write a function that has one input, a square (n x n, for any integer n) matrix. It should return three outputs: D, A, and B. Every square matrix has a upper left to lower right diagonal. For instance, the following matrix: [1 2 3] 4 5 6 17 8 9 Has the diagonal: 5 5 9 Your first output, D, should be the diagonal of your input matrix, with all other numbers set to 0. In the above matrix, it would be: 11 001 0 5 0 Lo 09 A and B should be the numbers ABOVE and BELOW that diagonal, respectively, with all other numbers set to 0. For instance, A in the above example would be: TO 2 31 0 0 6 lo 0 0 And B would be: 07 4 0 0 17 8 0] 0 50 Lo 09 A and B should be the numbers ABOVE and BELOW that diagonal, respectively, with all other numbers set to 0. For instance, A in the above example would be: TO 2 31 0 0 6 Lo 0 0 And B would be: [0 0 07 4 0 17 8 0 We strongly recommend using nested loops to accomplish these tasks, though other answers will be accepted

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

Students also viewed these Databases questions

Question

Discuss the activities that constitute effective safety management.

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago