Question

Generate a 4 x 4 random integer matrix, save it in the variable mat and perform...

Generate a 4 x 4 random integer matrix, save it in the variable mat and perform the following: ( MATLAB)

  1. Generate a matrix from the matrix mat that is composed of row 2, row 1 and row 3 of mat
  2. Generate a matrix from the matrix mat that is composed on column 2 and 3 of mat
  3. Generate a matrix from the matrix mat that starts with column 2 and row 3 and contains all the elements till the end.

Homework Answers

Answer #1

Generate a 4 x 4 random integer matrix, save it in the variable mat and perform the following:

>>mat=magic(4)

Generate a matrix from the matrix mat that is composed of row 2, row 1 and row 3 of mat

>>mat2 = mat(1:3,)

Generate a matrix from the matrix mat that is composed on column 2 and 3 of mat

>>mat3=mat(,2:3)

Generate a matrix from the matrix mat that starts with column 2 and row 3 and contains all the elements till the end.

>>mat4=mat(3: , 2: )

Know the answer?
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
Similar Questions
Create a matrix 4x4 of integer random numbers between 1 and 50, and perform the following...
Create a matrix 4x4 of integer random numbers between 1 and 50, and perform the following operations: a. Generate a (1x3) matrix of the original b. Generate a (4x2) matrix of the original with the row order reversed c. Replace the second column of the matrix with [4; 8 ; 16; -2] ( MATLAB)
1. Given a matrix variable "mat", write code using for loops, if statements, etc. that will...
1. Given a matrix variable "mat", write code using for loops, if statements, etc. that will accomplish the same as the following: matsum = sum(mat') Please make sure to store the result in "matsum" and dont use sum. This is what I have so far but it keeps telling me is wrong.... % mat has been initialized for you: mat = randi([-100,100],randi([15,20]),randi([15,20])); % write your statements that accomplish the code above: [r c]=size(mat); for i=1:c matsum=0; for j=1:r matsum=matsum+mat(j,i); end...
how do you generate data for a y random variable in matlab? If x has uniform...
how do you generate data for a y random variable in matlab? If x has uniform distribution (0,1) y has uniform distribution (a,b) Then write a matlab code using rand() command to generate data from distribution of y y = ? + ?x a,b, rand()
*** Write a function called reverse_diag that creates a square matrix whose elements are 0 except...
*** Write a function called reverse_diag that creates a square matrix whose elements are 0 except for 1s on the reverse diagonal from top right to bottom left. The reverse diagonal of an n-by-n matrix consists of the elements at the following indexes: (1, n), (2, n-1), (3, n-2), … (n, 1). The function takes one positive integer input argument named n, which is the size of the matrix, and returns the matrix itself as an output argument. Note that...
Let X be a discrete random variable with positive integer outputs a show that p (X=...
Let X be a discrete random variable with positive integer outputs a show that p (X= K)= P( X> K-1) - P( X> k) for any positive integer k b Assume that for all k >I we have P (X>k)=q^k  use l() to show that X is a geometric random variable
PLEASE USE MAT LAB ONLY. THANK YOU (a) Create and plot the signals listed below and...
PLEASE USE MAT LAB ONLY. THANK YOU (a) Create and plot the signals listed below and save your Matlab code in a script file. i) Cosine signal of frequency 100 Hz over the range [0,0.1] seconds and samples spaced 10^- 4 seconds apart with a phase of pi/2 and an amplitude of 1.   PLEASE USE MAT LAB ONLY. THANK YOU ii) A square wave that oscillates between 0 and 1 every five samples, plot 3 periods of the waveform. iii)...
1. (a) Construct the matrix Upper A equals left bracket Upper A Subscript ij right bracketA=Aij...
1. (a) Construct the matrix Upper A equals left bracket Upper A Subscript ij right bracketA=Aij if A is 2*3 and Upper A Subscript ij Baseline equals negative i plus 4 jAij=−i+4j. ​(b) Construct the 2*4 matrix Upper C equals left bracket left parenthesis 3 i plus j right parenthesis squared right bracketC=(3i+j)2. 2. Solve the following matrix equation. left bracket Start 2 By 2 Matrix 1st Row 1st Column 3 x 2nd Column 4 y minus 5 2nd Row...
A Poisson random variable is a variable X that takes on the integer values 0 ,...
A Poisson random variable is a variable X that takes on the integer values 0 , 1 , 2 , … with a probability mass function given by p ( i ) = P { X = i } = e − λ λ i i ! for i = 0 , 1 , 2 … , where the parameter λ > 0 . A)Show that ∑ i p ( i ) = 1. B) Show that the Poisson random...
let x be a discrete random variable with positive integer outputs. show that P(x=k) = P(...
let x be a discrete random variable with positive integer outputs. show that P(x=k) = P( x> k-1)- P( X>k) for any positive integer k. assume that for all k>=1 we have P(x>k)=q^k. use (a) to show that x is a geometric random variable.
Q) a) create a matrix named as X of evenly spaced values from 0 to 50,...
Q) a) create a matrix named as X of evenly spaced values from 0 to 50, with an increment of 10. b) a) create a matrix named as Y of evenly spaced values from 500 to 1000, with an increment of 3. c)a) create a matrix named as Z, the value of the 1st row is from 1 to 10, 2nd row from 2 to 20 with increment of 2, 3rd row 3 to 12. using subplot divide the window...