Question

MATLAB13) Write a code where the elements of a squared matrix size (order) n are equal to the sum of its row and column position (i+j)

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

copyable code:

clc;
clear all;
%getting size of the square matrix
size = input('Provide the size of the square matrix : ');
%loops for row
for i=1:size
%loop for columns
for j=1:size
M(i,j) = i+j;
end
end
%displays the matrix
disp(M);

Add a comment
Know the answer?
Add Answer to:
MATLAB Write a code where the elements of a squared matrix size (order) n are equal...
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
  • 2. Matrix A = Matrix B = log(A) Write MATLAB expressions to do the following. Evaluate...

    2. Matrix A = Matrix B = log(A) Write MATLAB expressions to do the following. Evaluate the sum of the first row of B Evaluate the maximum value in the vector resulting from element-by-element multiplication of the first column of B with the third column of A. Use element-by-element division to divide the third row of A by the first three elements of the second column of B and evaluate the sum of the elements of the resulting vector.

  • cope the code please thanks Write a MATLAB code to obtain the following. Keep your code...

    cope the code please thanks Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your source code and command widow outcomes and screen shots of any plots in your solution. Generate a matrix "A" as follow. A= 16 6 8 2 10 18 12 14 4 I. II. Divide the matrix A by 2 and store the result in a matrix B. Combine matrices A & B to obtain the following matrix C. Also...

  • Given a matrix of size NxM sorted in descending order and value V, write a function...

    Given a matrix of size NxM sorted in descending order and value V, write a function which returns -1 if value V is not in the matrix, else it returns 1 if V is in the matrix. The function also computes the position of V in the matrix, that is P= [R, C], where R is the row number of V and C is the column number of V in the matrix, if V is in the matrix (if V...

  • In the text book subscripted indexing is used to refer to elements in a matrix. Determine...

    In the text book subscripted indexing is used to refer to elements in a matrix. Determine the indices (i=row number and j=column number) of the maximum value of the elements in the given matrix Z. for Matlab

  • I want to change this C code so that instead of prompting the user to enter...

    I want to change this C code so that instead of prompting the user to enter the argument value, or requiring the argument be entered after by pressing the “enter” key, instead I want the code changed so that the program opens a file, (which include the input values) read in the elements and pass in the input file as a command line argument. (the input file includes the size of the matrix and the matrix values) Here's an example...

  • Write a code that gets the quiz grades of a class. A matrix with n rows...

    Write a code that gets the quiz grades of a class. A matrix with n rows and m columns where n stands for number of students and m is the number of quizzes. Let’s call the matrix A. Then, your code drops the lowest grade of each student and remove it from the matrix. Also, it finds the average grade for the quizzes for each student and add a new column to the end the matrix. in matlab please

  • JAVA Write a method that returns the sum of all the elements in a specified column...

    JAVA Write a method that returns the sum of all the elements in a specified column in a matrix using the following header: public static double sumColumn(double [][] m, int columnIndex) Write another method that returns the sum of all the elements in a specified row in a matrix using the following header: public static double sumRow( double [][] m, int rowIndex) Write a test program that reads a 3-by-4 matrix and displays the sum of each column and sum...

  • Write a program that reads a matrix from the keyboard and displays the summations of all...

    Write a program that reads a matrix from the keyboard and displays the summations of all its rows on the screen. The size of matrix (i.e. the number of rows and columns) as well as its elements are read from the keyboard. A sample execution of this program is illustrated below: Enter the number of rows of the matrix: 3 Enter the number of columns of the matrix: 4 Enter the element at row 1 and chd umn 1: 1...

  • Let A be an n×n matrix. Mark each statement as true or false. Justify each answer. a. An n×n determinant is define...

    Let A be an n×n matrix. Mark each statement as true or false. Justify each answer. a. An n×n determinant is defined by determinants of (n−​1)×​(n−​1) submatrices. b. The​ (i,j)-cofactor of a matrix A is the matrix obtained by deleting from A its I’th row and j’th column. a. Choose the correct answer below. A. The statement is false. Although determinants of (n−​1)×​(n−​1)submatrices can be used to find n×n determinants,they are not involved in the definition of n×n determinants. B....

  • Please write in Java in Jgrasp check code before posting Please write in Java in Jgrasp...

    Please write in Java in Jgrasp check code before posting Please write in Java in Jgrasp check code before posting Please write in Java in Jgrasp check code before posting, will give thumbs up FOP- 2. Write a program that ciphers a plain text message using double transposition scheme and vice versa. [50 Marks) The program should accept five tuples of input: plain text, row, column, permutation of row and columns. An example of encrypted text for the plain text...

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