Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Not all matrices have an inverse. A matrix which has an inverse must have a non-zero determinant. Copy the script below into a new M-file
Not all matrices have an inverse. A matrix which has an inverse must have a non-zero determinant. Copy the script below into a new M-file myInverse.m, and replace % CONDITION with a conditional statement that checks if det (A) is equal to 0. [1 2 3; 1 2 3; 1 2 3]; 2 if % CONDITION disp('The matrix A is:') disp(A) disp('Determinant is 0, A has no inverse') else disp('The matrix A is:') disp(A) disp('The inverse of A is:') disp(inv(A)) 9. 10 11 12 end Update your script so that you get the following output in the Command Window when you click 'Run': >> my Inverse The matrix A is: -1 -1 -4 -2 -1 -1 The inverse of A is 0.7000 -0.2000 0.1000 0.6500 -0.4000 -0.0500 0.4500 -0.2000 0.3500 Upload your updated myInverse.m below. Upload your M-file Make sure your M-file is saved (i.e. there is no * next to the filename in the MATLAB Editor window). Then click "Choose File" and choose the correct script. Afterwards, click "Upload your M-file", which will upload your updated script for marking. Choose file No file chosen Upload your M-file 0% The script supplied to you in Exercise 5 is breaking one of the three simple rules of good programming - 'don't repeat yourself. Modify your script so that the output is exactly the same, but you do not repeat the following lines of code more than once: disp('The matrix A is:') disp(A) Copy-paste the contents of your updated script below
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started