Question

(1) Matrices are entered row-wise. Row commas. Enter 1 2 3 (2) Element A, of matrix A is accesser (3) Correcting an entry is

(17)Create a matrix K using submatrices made up of utility matrices: ones, zeros, and the my matrices: ones, zeros, and the i

on matlab

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

MATLAB:

1)

>> A=[1 2 3; 4 5 6; 7 8 9]
A =

1 2 3
4 5 6
7 8 9

2)

>> A(2,3)
ans = 6

3)
>> A(3,3)-9
ans = 0

4)
>> B=A(2:3,1:3)
B =

4 5 6
7 8 9

5)

>> B=A(2:3,:)
B =

4 5 6
7 8 9

6)

>> B(:,2)=[]
B =

4 6
7 9

7)

>> A=[1 2 3;4 5 6;7 8 9];

>> x=A(1,:)'
x =

1
2
3

8)

>> x*x'
ans =

1 2 3
2 4 6
3 6 9

>> x'*x
ans = 14

9)
>> A*x
ans =

14
32
50

10)

>> A^2
ans =

30 36 42
66 81 96
102 126 150

11)

>> A.^2
ans =

1 4 9
16 25 36
49 64 81

12)

>> eye(3)
ans =

Diagonal Matrix

1 0 0
0 1 0
0 0 1

13)

>> eye(4,6)
ans =

Diagonal Matrix

1 0 0 0 0 0
0 1 0 0 0 0
0 0 1 0 0 0
0 0 0 1 0 0

14)

>> zeros(3,5)
ans =

0 0 0 0 0
0 0 0 0 0
0 0 0 0 0

15)

>> ones(5,8)
ans =

1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1

16)

>> rand(4,4)
ans =

0.612710 0.872208 0.720667 0.570826
0.544332 0.556898 0.329526 0.529136
0.708312 0.665066 0.397935 0.717848
0.892258 0.995077 0.026875 0.834681

17)

>> K=[ones(3) zeros(3,2)]
K =

1 1 1 0 0
1 1 1 0 0
1 1 1 0 0

18)

>> K=[ones(3) zeros(3,2);zeros(2,3) 4*eye(2)]
K =

1 1 1 0 0
1 1 1 0 0
1 1 1 0 0
0 0 0 4 0
0 0 0 0 4

19)

>> diag(K)
ans =

1
1
1
4
4

20)

>> diag(K)'
ans =

1 1 1 4 4

Add a comment
Know the answer?
Add Answer to:
on matlab (1) Matrices are entered row-wise. Row commas. Enter 1 2 3 (2) Element A,...
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
  • Which of the following is an INCORRECT statement: 1) MATLAB command eye(n) makes an nxn identity...

    Which of the following is an INCORRECT statement: 1) MATLAB command eye(n) makes an nxn identity matrix 2) Identity matrix is square matrix with ones on main diagonal and zeros elsewhere 0 3) Matrix multiplication on any array with the identity matrix changes the array 4) Matrix B is the inverse of matrix A if matrix product of A and B is the identity matrix

  • in matlab 6. Create a big matrix with submatrices: The following matrix G is created by inserting the matrices A, B, an...

    in matlab 6. Create a big matrix with submatrices: The following matrix G is created by inserting the matrices A, B, and C from Exercise 3, together with zero matrices and 2 x 2 identity AY NOT llr SIIAIut. UMOADIT, SOLD Og1 DISTIunUTII》 THIS CONTENT IS PROTECTED AND M 019 2 CopprightQ Schoall of Mathercatical and Statistical Sceom Ariaona State Cniseesity matrices in the appropriate position. Create the matrix using submatrioes A, B, C, zeros and eye (that is, you...

  • The colde provided solbe)() 1, y(5).nthe ntred aproimation o 100 no y value prob 1) -1. บู(5) -2,...

    Please provide me the maximum computed y vector for the given domain The colde provided solbe)() 1, y(5).nthe ntred aproimation o 100 no y value prob 1) -1. บู(5) -2, on the interval-rousing a centred approximation of the derivative term and N-100 nodes. dr2 Matlab code for the solution of Module 2 3 xright-5; 4 N 188: 5 x=linspace(xleft , X right ,N); 6 x-x"; %this just turns x into a column vector 7 dx = (xright-xleft)/(N-1); %1f theres N...

  • Need help with this MatLab exercise. Please show all commands in MatLab. Enter the following matrices...

    Need help with this MatLab exercise. Please show all commands in MatLab. Enter the following matrices and vectors in MATLAB [ 2 -6 3 ] [ 5 ] -3 A= 2 -7 -2 , B= 2 -2 -3 , b= -13 , c= 3 -1 4], d= 0 [ 7 -2 7 [1 -8 -1 ] [ 10 (a) Perform the following operations: AB, BA, CA and Bd (use standard linear algebra multiplication). - 3 (b) Construct a 6 x...

  • 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,...

  • *** 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 nby- 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...

  • The code provided solves the boundary value problem 2 dr2 cos(a), J(1) , y(5)2.on the interval To...

    Please provide code and final answer. The code provided solves the boundary value problem 2 dr2 cos(a), J(1) , y(5)2.on the interval Toxksusing a Centred approximation of the derivative term and N= 100 nodes 1 we% Matlab code for the solution of Module 2 3 xright=5; 4 N 100; 5 x-linspace(xleft,xright,N); x x'; %this just turns x into a column vector dx- 7 (xright-xleft)/(N-1); %If theres N nodes, theres N-1 separations . 9 yright 2; 10 here is the matrix...

  • Matlab answer only Form 1 6) [10 pts] Consider the following two matrices B=[S A 3...

    Matlab answer only Form 1 6) [10 pts] Consider the following two matrices B=[S A 3 1 5 -7 4 6-3] a) Obtain the sum of each row of matrix A. b) Use the size function to create a magic matrix P which has the same size as matrix A. c) Create a matrix called Q from the second column of matrix A d) Extract the four numbers in the lower left-hand corner of matrix A and create matrix R....

  • 3. Random matrices are matrix generalization of random variables. To examine the distribution of eigenvalues of...

    3. Random matrices are matrix generalization of random variables. To examine the distribution of eigenvalues of such matrices, first generate a 100x100 random matrix with elements selected from a random distribution of ones and zeros (to do this you can start with the function rand( ) together with round( ) or alternatively randi( )) and then find the absolute value (the norm) of each the eigenvalues of this matrix with the routine eig。 Repeat this 100 times storing all the...

  • Use the attached Matlab code as a basis to solve the following ordinary differential equation usi...

    Question 1 QUESTION 2 Use the attached Matlab code as a basis to solve the following ordinary differential equation using Euler's method, with timestep of 0.1, from t-0to t-100. d)0) -0 - sin (5vt cos(у Plot y versus t from t=0 to t=100. How many local maxima are on this interval(do not include end points). Be careful to count them all! Answer should be an integer 1 w% Matlab code for the solution of Module 2 3 dt-9.1; %dt is...

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