Question

In: Computer Science

MATLAB Create a 2 × 3 matrix variable mat. Pass this matrix variable to each of...

MATLAB

Create a 2 × 3 matrix variable mat. Pass this matrix variable to each of the following functions and make sure you understand the result: flip, fliplr, flipud, and rot90. In how many different ways can you reshape it?

Note: (in addition to the functions listed, rotate the matrix 180 degrees clockwise)

Solutions

Expert Solution

Creating a random 2x3 matrix.  
    command: mat = rand(2,3)*10

    output:

   2.9948   7.6017   5.7173
   4.9625   1.2664   1.7056

   Now applying different commands as given in the problem.

     command: flip(mat) -> flips rows (row 1 in place of row 2 and vice- versa)

      output:

     4.9625       1.2664      1.7056

   2.9948   7.6017   5.7173

    command: fliplr(mat) -> flips left most column with the right most column

      output:

     5.7173       7.6017     2.9948

   1.7056   1.2664   4.9625

  

    command: flipud(mat) -> flips up and down, here same as flip(mat)

      output:

     4.9625       1.2664      1.7056

   2.9948   7.6017   5.7173

     command: rot90(mat) -> rotated mat by 90 degrees in counterclockwise direction

      output:    

   5.7173   1.7056
   7.6017   1.2664
   2.9948   4.9625

     Rotating matrix by 180 degrees in clockwise:
     commands : fliplr(flip(mat))

      output:

     1.7056      1.2664       4.9625

   5.7173   7.6017   2.9948

Related Solutions

IN MATLAB, Create a 8x8 magic matrix. Then use MATLAB built in function, sum, to calculate...
IN MATLAB, Create a 8x8 magic matrix. Then use MATLAB built in function, sum, to calculate the sum of each column. Use subscript notation to find the 6th element and the last element of each magic square. Find the maximum of all the elements in each magic square.
Code in Matlab for a low pass filter and a high pass filter. Each filter must...
Code in Matlab for a low pass filter and a high pass filter. Each filter must show the frequency response (magnitude and phase) in graphs properly labelled.
MATLAB: Matrix M = [ 0 2 3 5; 7 3 8 4 ] Write one...
MATLAB: Matrix M = [ 0 2 3 5; 7 3 8 4 ] Write one command that stores all of the rows of columns 1, 2, and 3 of M into a matrix named M2.
a. Using Matlab scripts create the following matrices (???1 and ???2) ???1 = [ 3 2...
a. Using Matlab scripts create the following matrices (???1 and ???2) ???1 = [ 3 2 −3 6 7 4 3 −6 7 ], ???2 = [ 2 1 7 3 3 9 −6 6 1 ]    b. Write code to add the second row of ???1 to the third row of ???2 and store results in the first row of ???1. c. Write code to add the second column of ???1 with the third column of ???2 and...
(MATLAB) Write a script that would create a 3x5 matrix of random integers and write this...
(MATLAB) Write a script that would create a 3x5 matrix of random integers and write this new matrix to a file called “Assignment3_Question5.dat”.
Give examples of 3 distinct types of filters (band pass, high pass, and low pass). Create...
Give examples of 3 distinct types of filters (band pass, high pass, and low pass). Create a diagram and a statement of the characteristic frequency scale of each in terms of the component values in the circuit.
2. For each 3*3 matrix and each eigenvalue below construct a basis for the eigenspace Eλ....
2. For each 3*3 matrix and each eigenvalue below construct a basis for the eigenspace Eλ. A= (9 42 -30 -4 -25 20 -4 -28 23), λ = 1,3 A= (2 -27 18 0 -7 6 0 -9 8), λ = −1,2 3. Construct a 2×2 matrix with eigenvectors(4 3) and (−3 −2) with eigen-values 2 and −3, respectively.
In matlab using a RC low pass filter Create a 1 Hz input signal (with amplitude...
In matlab using a RC low pass filter Create a 1 Hz input signal (with amplitude of one). Corrupt the input signal with signals greater than or equal to 100 Hz and/or random noise. Use randn(length(v_in,1)) to test filter
use matlab to create a function that finds inverse of 2x2 matrix and returns result. Should...
use matlab to create a function that finds inverse of 2x2 matrix and returns result. Should be a error check to make sure matrix is 2x2, and nonsingular.
Let U = {A ∈ Mat(2; ℚ) : AB = BA for all B ∈ Mat(2;...
Let U = {A ∈ Mat(2; ℚ) : AB = BA for all B ∈ Mat(2; ℚ)}. (i) Show that  U is a subspace of Mat(2; ℚ). (ii) Show that E ∈ Mat(2; ℚ) is a basis of U. (E: identity matrix) (iii) Find the complement for U
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT