please using the matlab language or java language Write a computer function that
ID: 3027849 • Letter: P
Question
please using the matlab language or java language
Write a computer function that takes a general n times n matrix A as input and computes its inverse A^-1 as output Implement the algorithm by hand, i.e., you shouldn't just call the Matlab function that computes the inverse Apply this function to compute, numerically, the inverse of the matrix of the previous problem. Do the same for Hilbert matrices of sizes 10 times 10, 100 times 100 and 200 times 200. In each case, verify numerically that AA^-1 = I Where I is the identity matrix. What do you observe?Explanation / Answer
Code1:-
clc
clear all
%some random matrix
A=[1,0,0;0,1,0;0,0,1]
I=calinv(A)
proof=A*I
Code2:-
% Hilbert matrices
clear all
clc
a1=hilb(10)%hilbert matrix of size 10
i1=calinv(a1)
proof=a1*i1
a2=hilb(100)%hilbert matrix of size 100
i2=calinv(a2)
proof=a2*i2
a3=hilb(200)%hilbert matrix of size 200
i3=calinv(a3)
proof=a3*i3
Function Code:-
function [I] = calinv(A)
I=inv(A);
end
Conclusion:- For small changes in the Hilbert matrix, it leads to greater perturbation. One can say that Hilbert matrices are nearly Singular Matrices.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.