Question

Create a matrix with 3 rows and 4 columns. Every element in the first row should...

Create a matrix with 3 rows and 4 columns. Every element in the first row should be 0, every element in the second row should be 1, and every element in the third row should be 2. But don’t just type out all the numbers. Use some ingenuity. Display the matrix using MATLAB.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

% matlab code to fill 3X3 matrix

% iteration over array
for i=1:3
% iterating over column
for j=1:3
% value at index (i,j)
matrix(i,j) = i-1;
end
end
% display matrix
disp(matrix);

%{
output:

0 0 0
1 1 1
2 2 2

%}

Add a comment
Know the answer?
Add Answer to:
Create a matrix with 3 rows and 4 columns. Every element in the first row should...
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
  • Can someone help me to solve it by Matlab? 7. Create a 5 row, 8 col...

    Can someone help me to solve it by Matlab? 7. Create a 5 row, 8 col matrix called mymat w ith random integers betwee n and including 70 and 90 Create a matrix from mymat called newmat whose entries consist of those entries which are both in the second and third rows, but also in the 4th through 6th columns 8. 9 What command would you type to list just the 4th row, 6th column entry of mymat? 1o. Crete...

  • A matrix A has 3 rows and 4 columns: a11 a12 a13 a14  a21 a22...

    A matrix A has 3 rows and 4 columns: a11 a12 a13 a14  a21 a22 a23 a24 a31 a32 a33 a34 The 12 entries in the matrix are to be stored in row major form in locations 7609 to 7620 in a computer’s memory. This means that the entires in the first row (reading left to right) are stored first, then entries in the second row, and finally entries in the third row. Which location with a22 be stored...

  • Problem 5 Create the following matrix by typing elements explicitly one command. Do not type individual...

    Problem 5 Create the following matrix by typing elements explicitly one command. Do not type individual 0 00 0 0 o o 0 0 0 0 0 1 2 3 F=0 01 10 20 0 0 2 8 26 0 0 3 6 32 E 0 045 6 0 0 7 8 9 Problem 6 Create two row vectors: a -4 10 0.5 1.8 -2.3 7, b [0.7 9 -53-0.6 12 (a) Use the two vectors in a MATLAB command...

  • 1. Write a MATLAB function that takes a matrix, a row number and a scalar as...

    1. Write a MATLAB function that takes a matrix, a row number and a scalar as arguments and multiplies each element of the row of the matrix by the scalar returning the updated matrix. 2. Write a MATLAB function that takes a matrix, two row numbers and a scalar as arguments and returns a matrix with a linear combination of the rows. For example, if the rows passed to the function were i and j and the scalar was m,...

  • MATLAB A square matrix is a matrix that has the same number of rows and columns....

    MATLAB A square matrix is a matrix that has the same number of rows and columns. Write a function issquare that will receive a matrix as input, and return logical 1 for true if it is a square matrix, or logical 0 for false if it is not. The function should also display a sentence stating whether the inputted matrix is square or not.

  • R assignment In the matrix() function: . The first argument is the collection of elements that...

    R assignment In the matrix() function: . The first argument is the collection of elements that R will arrange into the rows and columns of the matrix. Here, we use 1:9 which is a shortcut for c(1, 2, 3, 4, 5, 6, 7, 8, 9) e The argument byrow indicates that the matrix is filled by the rows. If we want the matrix to be filled by the columns, we just place byrow FALSE. . The third argument nrow indicates...

  • using matlab Create the following matrix B. [18 17 16 15 14 13] 12 11 10...

    using matlab Create the following matrix B. [18 17 16 15 14 13] 12 11 10 9 8 7 6 5 4 3 2 1 Use the matrix B to: (a) Create a six-element column vector named va that contains the elements of the second and fifth columns of B. (6) Create a seven-element column vector named vb that contains elements 3 through 6 of the third row of B and the elements of the second column of B. Create...

  • How do I solve using Matlab? Create a matrix X so that the first row has...

    How do I solve using Matlab? Create a matrix X so that the first row has values from 0 to 50 (default intervals), and the second row has values from 50 to 100. Let matrix Y equal to x10 and Z equal to x + y2 Create 4 subplots containing a mesh, surface, 3-Dimensional, and a surface-contour plot. Label with appropriate titles and labels. The plots should have a string look to them.

  • I am having trouble figuring out why my program will not make any columns, just rows....

    I am having trouble figuring out why my program will not make any columns, just rows. I need to display a square. The instructions are provided below. (This for my C++ class) Write a program that displays a square. Ask the user for the square’s size. Only accept positive integer numbers (meaning choose a data type that holds positive integer values). The size the user gives you will determine the length and width of the square. The program should then...

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