To solve the system AX=B for different B's in Matlab, you can use the following code:
main.m136 chars8 lines
This will give you X1, X2 and X3 as solutions for each of the B's.
To calculate the maximum possible relative error of the right-hand side in 2-norm, you can use the following formula:
main.m36 chars2 lines
where A is the coefficient matrix, B is the exact right-hand side (in this case, any of the B's), and C is the approximate right-hand side (in this case, any of the solutions X1, X2, or X3).
For example, to calculate the maximum possible relative error of B1, you can use the following code:
main.m59 chars4 lines
This will give you the maximum possible relative error for B1. You can repeat the same for B2 and B3 to get the maximum possible relative error for those as well.
gistlibby LogSnag