Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have part a done i need help with b. (a) Write a Matlab function program myinv

ID: 3664794 • Letter: I

Question

I have part a done i need help with b.

(a) Write a Matlab function program myinvcheck that • makes a n × n random matrix (normally distributed, A = randn(n,n)), • calculates its inverse (B = inv(A)), • multiplies the two back together, • calculates the residual (difference from the desired n × n identity matrix eye(n)), and • returns the norm of the residual.

my Code:

function x = myinvcheck(n)
A = randn(n,n)
B = inv(A)
C = A*B
D = eye(n)
x = norm(D);
end

(b) Write a Matlab script program that calls myinvcheck for n = 10, 20, 40, . . . , 2 i10 for some moderate i, records the results of each trial, and plots the error versus n using a log plot. (See help loglog.) What happens to error as n gets big? Turn in a printout of the programs, the plot, and a very brief report on the results of your experiments.

Explanation / Answer

b)

first you save your function in matlab.after that the main program in which you are going to use that function is also being saved(don't write it on command window.write it as M-file and now run this program),actually there is no problem in your program.you just doing mistakes in running that program.