Question

By using Matlab, (a) Suppose A is a matrix whose entries are all positive numbers. Write...

By using Matlab,

(a) Suppose A is a matrix whose entries are all positive numbers. Write one line that will multiply each column of A by a scalar so that, in the resulting matrix, every column sums to 1.

(b) Try this more difficult variation: Suppose that A may have zero entries, and leave a column of A that sums to zero unchanged.

please help with this, I tried to use this:

A = round(4*rand(4,5)+1)

A./sum(A),[size(A,1) 1]

but this did not work at all,

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

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

clc
clear all
A = round(rand(3,4))
A(:,find(sum(A)~=0))=A(:,find(sum(A)~=0))./sum( A(:,find(sum(A)~=0)))

MATLAB R2018a Search Documentation Log In HOME PLOTS APPS EDITOR PUBLISH VEW Insert fx Find Files Run Section Go To Compare C

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
By using Matlab, (a) Suppose A is a matrix whose entries are all positive numbers. Write...
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
  • Please answer through MATLAB and show WHOLE script. 1. An n x n matrix is said...

    Please answer through MATLAB and show WHOLE script. 1. An n x n matrix is said to be diagonally dominant if , lail for i = 1,...,n ji Basically, if for every row, the absolute value of the entry along the main diagonal is larger than the sum of the absolute values of all other entries on that row. Write a function whose input is a matrix and will determine (true/false) if a matrix is diagonally dominant. Show that your...

  • Theory: A vector with nonnegative entries is called a probability vector if the sum of its entries is 1. A square matrix...

    Theory: A vector with nonnegative entries is called a probability vector if the sum of its entries is 1. A square matrix is called right stochastic matrix if its rows are probability vectors; a square matrix is called a left stochastic matrix if its columns are probability vectors; and a square matrix is called a doubly stochastic matrix if both the rows and the columns are probability vectors. **Write a MATLAB function function [S1,S2,P]=stochastic(A) which accepts a square matrix A...

  • how can i solve the system of these magic matrices using matlab software ? Exercice 3. A magic matrix is a square matrix with integer entries in which all the rows, columns and the two diagona...

    how can i solve the system of these magic matrices using matlab software ? Exercice 3. A magic matrix is a square matrix with integer entries in which all the rows, columns and the two diagonals have the same sum. For example, A- 3 5 7 4 9 2 Complete the following magic matrices 17? ?? 3 ? 2 ? 2? ? Do the following steps in each case: 1. Write the system of equations and put it under the...

  • Let M4x3 be the vector space of all 4 x 3 matrices with real entries. Note...

    Let M4x3 be the vector space of all 4 x 3 matrices with real entries. Note that M4x3 R12 (M4x3 is isomorphic to R12). Let Z4x3 = {A E M4x3 | all row and column sums of Z are zero}. For example, A= -5 3 2 1 -3 2 1 2 -3 3 -2 -1 is an element of Z4x3. (a) Find a 7 x 12 matrix C whose null space is isomorphic to Z4x3. In other words, find a...

  • MATLAB simulate the game "Threes!" in MATLAB. The "game board" should take place on a 4x4...

    MATLAB simulate the game "Threes!" in MATLAB. The "game board" should take place on a 4x4 matrix. Simulate empty matrix cells with zeros. o a zero isan empaty space and a non-empty sG-) An example 0 2 2 1 Gameboard vw1 230 Thejndividual custom function should be able to take any ONE number within the gameboard id axci tme i funcon should uillixe branches io accout for all pssibl scenarios (the number is already against the wall, it is blocked...

  • Suppose that A is diagonalizable and all eigenvalues of A are positive real numbers. Prove that...

    Suppose that A is diagonalizable and all eigenvalues of A are positive real numbers. Prove that det (A) > 0. (1 point) Suppose that A is diagonalizable and all eigenvalues of A are positive real numbers. Prove that det(A) > 0. Proof: , where the diagonal entries of the diagonal matrix D are Because A is diagonalizable, there is an invertible matrix P such that eigenvalues 11, 12,...,n of A. Since = det(A), and 11 > 0,..., n > 0,...

  • Using Matlab Write a program which will: a. Accept two numbers from the user m and...

    Using Matlab Write a program which will: a. Accept two numbers from the user m and n b. Define an array with the dimensions a(n,m) and fill it with random numbers in the range of -100 to 100 inclusive. c. Provide the user the following menu from which he can select: 1. Sum of all elements in the array. Print the result. 2. Sum of the element in a row that he’ll specify. Print the result. 3. Sum of the...

  • Can you help me with this question please? For the code, please do it on MATLAB. Thanks

    Can you help me with this question please? For the code, please do it on MATLAB. Thanks 7. Bonus [3+3+4pts] Before answering this question, read the Google page rank article on Pi- azza in the 'General Resources' section. The Google page rank algorithm has a lot to do with the eigenvector corresponding to the largest eigenvalue of a so-called stochastic matrix, which describes the links between websites.2 Stochastic matrices have non-negative entries and each column sums to1, and one can...

  • MATLAB MATLAB MATLAB Consider the diagram below V R$ Here, each V represents a change in...

    MATLAB MATLAB MATLAB Consider the diagram below V R$ Here, each V represents a change in voltage (in volts) at a battery, each R represents a resistance in ohms) at a resistor and each I represents a current (in amps) through a wire. These quantities obey two simple laws: 1. Ohm's law: The voltage drop across a resistor is V = IR. 2. Kirchhoff's second law: The sum of all the voltage changes in a closed loop is zero. Using...

  • write a program using MATLAB ‘A’ contains all account numbers and balances. ‘B’ contains debits/credits for...

    write a program using MATLAB ‘A’ contains all account numbers and balances. ‘B’ contains debits/credits for each account. Write a program that updates ‘A’ based on information in ‘B’. Also create a separate matrix ‘C’ that contains only the new accounts not in A. A= Acct# Balance [5 1000 2 5000 82 68 7 10] B= Acct# Credit/Debit [5 -100 8 2000 12 3000 14 1 7 -20] Output A= Acct# Balance [5 900 2 5000 8 2002 6 8...

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