Question

MATLAB Create a matrix E, using A and B vectors as row 1 and row 2...

MATLAB

Create a matrix E, using A and B vectors as row 1 and row 2 respectively

A = 10 thru 1

B = 1 thru 4.2 with ten equally spaced elements

and

  1. Find the indices (row and col) within E where (prob02a, b, c, d)

    1. E = 5

    2. E > 4

    3. E < 1.9

    4. E > 1 and E < 2

Homework Answers

Answer #1

A=10:-1:1;
B=linspace(1,4.2,10);
E=[A;B]

fprintf('E=5 indices\n')
for i=1:2
for j=1:10
if(E(i,j)==5)
fprintf('row =%d col=%d\n',i,j);
end
end
end

fprintf('\nE>4 indices\n')
for i=1:2
for j=1:10
if(E(i,j)>4)
fprintf('row =%d col=%d\n',i,j);
end
end
end

fprintf('\nE<1.9 indices\n')
for i=1:2
for j=1:10
if(E(i,j)<1.9)
fprintf('row =%d col=%d\n',i,j);
end
end
end

fprintf('\nE>1 and E<2 indices\n')
for i=1:2
for j=1:10
if(E(i,j)>1 && E(i,j)<2)
fprintf('row =%d col=%d\n',i,j);
end
end
end

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
let us create a variable for a row vector a = [1, 4, 1, 3, 2,...
let us create a variable for a row vector a = [1, 4, 1, 3, 2, 5, 0] and calculate the mean value of its elements using the Matlab function ‘mean’ and store this value in variable aMean. Fig. 1 gives the Matlab code to do this. a = [1, 4, 1, 3, 2, 5, 0]; aMean = mean(a); Figure 1: Matlab code – row vector and mean of its elements. Let us now construct a row vector b that...
All these to be done in MATLAB: 1.1)Define a column vector, called “b” in MATLAB that...
All these to be done in MATLAB: 1.1)Define a column vector, called “b” in MATLAB that stored floating point numbers between 0.6 to 2.5 in increment of 0.2. 1.2)What is the size of vector b? How is the size of ‘b’ stored? Define number of rows of ‘b’ in variable ’row’ and number of columns of “b” in variable “col”. 1.3)Define matrix “A” as a 10 by 10 matrix of all “1”s. 1.4)Update matrix “A” as following: set all the...
Using MATLAB, create three vectors a = 4i, b = 2i - 4j, and c =...
Using MATLAB, create three vectors a = 4i, b = 2i - 4j, and c = -2i + 3k, where i, j and k are unit vectors of three axes in Cartesian coordinate system. Compute |?∙(?×?)| using the predefined MATLAB commands and show that it is the volume of a parallelepiped defined by three vectors a, b and c.
1. Let a,b,c,d be row vectors and form the matrix A whose rows are a,b,c,d. If...
1. Let a,b,c,d be row vectors and form the matrix A whose rows are a,b,c,d. If by a sequence of row operations applied to A we reach a matrix whose last row is 0 (all entries are 0) then:        a. a,b,c,d are linearly dependent   b. one of a,b,c,d must be 0.       c. {a,b,c,d} is linearly independent.       d. {a,b,c,d} is a basis. 2. Suppose a, b, c, d are vectors in R4 . Then they form a...
Write MATLAB code to create a 5x5 matrix A with 2's on the diagonal, and -1...
Write MATLAB code to create a 5x5 matrix A with 2's on the diagonal, and -1 on the super- and sub-diagonal. Then replace the (1,1) element of A with a 1. (Make your commands capable of handling an arbitary sized NxN matrix by first defining N=5, then using the variable N as the size in each of the commands.)
In the code space provided in Matlab Grader, create a function that: 1. Accepts an input...
In the code space provided in Matlab Grader, create a function that: 1. Accepts an input matrix A as its only input argument. Matrix A is a 3x3 matrix of random integers between 1 and 4 2. Produces and output matrix B as its only output argument. Matrix B will also be a 3x3 matrix. 3. Calculates the elements of matrix B such that: a. the values of B along the diagonal are equal to the respective elements in A...
Exercise 1: Write MATLAB code to create a 5x5 matrix A with 2's on the diagonal,...
Exercise 1: Write MATLAB code to create a 5x5 matrix A with 2's on the diagonal, and -1 on the super- and sub-diagonal. Then replace the (1,1) element of A with a 1. (Make your commands capable of handling an arbitary sized NxN matrix by first defining N=5, then using the variable N as the size in each of the commands.)
Part 2: Solve the following problems in MATLAB 1. Fill in the function E = myElim(A,...
Part 2: Solve the following problems in MATLAB 1. Fill in the function E = myElim(A, r_entry, r_pivot, c) to create an m by m elimination matrix ??. Remember that an elimination matrix looks like an identity matrix with one extra entry of ?? in row r_entry and column r_pivot. 2. Fill in the function M = myMult(A, c_pivot) to create an m by m multiplier matrix ??. Remember that a multiplier matrix looks like an identity matrix with the...
By Using Matlab Matcal (A, B) returns matrix A and B products, while printing the matrix...
By Using Matlab Matcal (A, B) returns matrix A and B products, while printing the matrix computation formula in outmat. txt file as follows. (The sizes of A and B are very variable. In other words, it shall be possible to perform operation for matrix operation of 2 x 2 size, and it shall also be possible to calculate and output for 100 X 100 matrix models. ) >> A = [1 23;4 56 ; 79] >> B = [0...
In MATLAB, generate a 3D plot as follows: Create 2 vectors x and y, both ranging...
In MATLAB, generate a 3D plot as follows: Create 2 vectors x and y, both ranging from -5 to 5 with interval of 0.05 using linspace or colon operator. Generate grid of values X and Y using the vectors x and y. Define the variable Z as follows: Z = 2X3 + 4Y2 + 7 +sinX3 + Y2 Generate a surface and a mesh plot with the variables X,Y,Z. Show your plots.