format long;if (n~=4)&(n~=50) 'Input value must be 4 or 50' return;endload(['data',num2str(n)],'A','b'); % load matrix A and b according to n
D=zeros(n,n); %Initialize D
%%%%%%%%%%%In the double-loop below, extract from A its diagonal part D,
for i=1:n for j=1:n if (i==j) D(i,j) = ???; end end end
MATLAB: Diagonal matrix help, this is the code, not sure what to put for the D(i,j) part
diagonalmatrix
Best Answer