Question: Needs a MATLAB code. Exercise 2.6 solution A = rand(3) 0.814 0.913 0.278 0.905 0.632 0.546 0.127 0.097 0.957 A(1: size(A,1) + 1:end) ans =

Needs a MATLAB code.
Exercise 2.6 solution

A = rand(3)
0.814 0.913 0.278
0.905 0.632 0.546
0.127 0.097 0.957
A(1: size(A,1) + 1:end)
ans = 0.814 0.632 0.957
Prints out the diagnol elements of the matrix A.
Suppose x is a column vector. Compute, without using loops or conditionals, the matrix A given by a_ij = {1/(x_i - x_j)^2 if i plusminus j, 1 otherwise. (One way to do this uses direct assignment to the diagonal elements of A. Using row/column style indices, this is rather tricky, but sec Exercise 2.6.) Suppose A is any matrix. What does this statement do? A(1: size(A, 1) + 1: end)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
