Question

5. Create the following matrix (M) using colon operators, and then transpose M to create a new matrix N. Multiply N by M to create a new matrix Z. Sort the rows of Z in descending order and assign to Y. Write codes to find out the index numbers of 54.54 in the new matrix Y. (20) 1.0 1.4 1.8 2.2 2.1 3.4 4.7 6.0 6.0 3.9 1.8 0.3
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Since no language is specified and the question needs to be solved by colon operators, I am assuming its Matlab.

I have shown outputs of M, N, Z, Y after every operation. You can suppress them by using semicolon.

(e.g. N=M' ; )

Here is the working code:

M(1,:) = 1.0:0.4:2.2; %Creating first row of M using colon operators
M(2,:) = 2.1:1.3:6.0; %Creating second row of M using colon operators
M(3,:) = 6.0:-2.1:-0.3; %Creating third row of M using colon operators

M                        %display M

N = M'                   %Transpose of M is N

Z = M*N

Y = sortrows(Z,[-1])     %Sort Z in descending order according to column 1

%%Find position of 54.54 in Y
for i =1:size(Y,1)
    for j=1:size(Y,2)
        if Y(i,j)==54.54
            [i j]
        end
    end
end

Here is the output:

Add a comment
Know the answer?
Add Answer to:
5. Create the following matrix (M) using colon operators, and then transpose M to create a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hi, can someone please help me implement the transpose, multiply(Matrix b), multiply(Matrix m, int threads), and...

    Hi, can someone please help me implement the transpose, multiply(Matrix b), multiply(Matrix m, int threads), and equals(Object in) methods? (This is Java) I really need help so please don't just refund the question. public class Matrix {1 public int[] [] matrix; 1 int[] [] trans; 1 public int x, y; 1 private boolean transposed; 1 1 public Matrix(int x, int y){1 matrix = new int[x][y1;1 this.x = x; this.y = y; 1 } 1 9 /*1 * This method takes...

  • I am trying to create a function to read 2 csv files that contain 5 columns...

    I am trying to create a function to read 2 csv files that contain 5 columns of data. Columns 1-4 are floats and column 5 is a string. I want to only work on with the floats to perform some calculations such as sum of the first 2 columns of each file and then return the closest numbers then return the string to identify the 2 rows of data. Below is what I have so far. There is a stipulation...

  • Part1 1. Given x- y+z=-2 x+ y-z=+2 Solve by Gassian Elimination not using matrices then using matrices. 1 Compute A transpose P A and A transpose* P *L 3. If m 5 and n = (a) How many rows are i...

    Part1 1. Given x- y+z=-2 x+ y-z=+2 Solve by Gassian Elimination not using matrices then using matrices. 1 Compute A transpose P A and A transpose* P *L 3. If m 5 and n = (a) How many rows are in A? (b) How many columns are in A? (c) How many rows are in P? (d) How many rows are in L? (e) What is the size of the system of equations that will be solved? (f) How many...

  • For this project, each part will be in its oun matlab script. You will be uploading a total 3 m f...

    For this project, each part will be in its oun matlab script. You will be uploading a total 3 m files. Be sure to make your variable names descriptive, and add comments regularly to describe what your code is doing and hou your code aligns with the assignment 1 Iterative Methods: Conjugate Gradient In most software applications, row reduction is rarely used to solve a linear system Ar-b instead, an iterative algorithm like the one presented below is used. 1.1...

  • Need C++ coding for this lab exercise given below :) 4. Lab Exercise — Templates Exercise...

    Need C++ coding for this lab exercise given below :) 4. Lab Exercise — Templates Exercise 1 - Function Templating For this part of the lab make a template out of the myMax function and test it on different data types. Copy maxTemplate.cpp to your Hercules account space. Do that by: Entering the command:cp /net/data/ftp/pub/class/115/ftp/cpp/Templates/maxTemplate.cpp maxTemplate.cpp Compile and run the program to see how it works. Make a template out of myMax. Don't forget the return type. Modify the prototype appropriately. Test your myMax template on int, double,...

  • Use the following tide table to answer the questions in the Assessing Your Learning section of...

    Use the following tide table to answer the questions in the Assessing Your Learning section of this lab. This tide table shows the predicted ocean heights for Santa Cruz/Monterey Bay, California during December 2011. 1. A visit to Santa Cruz/Monterey Bay, California is planned during the week of December 4-10 to view the tide pools. To observe intertidal animals during the daytime at the lowest possible tide, the best time to visit the beach is on _________________ at _________________. (4...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT