In MATLAB, we can solve the system ax = b using the backslash operator \. So, for solving the system for different b's, we can write the following code:
main.m336 chars17 lines
To find the maximum relative error of the solution in 2-norm, we can use the following formula:
max(|x - x_hat| / |x|), where x is the exact solution and x_hat is the approximate solution.
main.m591 chars21 lines
The maximum relative error for any of the given b vectors can be up to 9.466e-16 in 2-norm.
gistlibby LogSnag