Using matlab i need to create code to fulfill the following requirements I need
ID: 3840954 • Letter: U
Question
Using matlab i need to create code to fulfill the following requirements
I need to use Cramers Rule in order to solve for the required variables.
Below is the assignment.
Please help,
Solving Simultaneous equations using Cramer's Rule Review of Cramer's Rule: Refer to the web for details of Cramer's Rule or previous textbooks. One website is: http://www.purplemath.com/modules/cramers.htm there are many others of varying levels of sophistication. Another website is http://en.wikipedia.org/wiki/Cramer%27s rule NOIE this is a three variable example X, y, Za A A3 B3 C3 Determinant in Matlab is D -det(CO), And K1 K2 K3 the constant vector K Then create in this case three matrices My, Mz here is an example of matrix for x Mr B2 K3 B Ce Made from CO Coefficient Matrix and K constant vector therefore for Mx K replaces col 1 in Matrix CO My K replaces col 2 in Matrix CO Mz K replaces col 3 in Matrix CO Ans, K and CO are to be dimensioned as n the number of equations and unknowns. In this case 3. Of course Ans and K are 1xn vectors and CO and the variable Matrices are all n x n arrays. Solution for the above set of equations is: Example solution x 2y z 0 Answers x 1, y 2, and z 3Explanation / Answer
function y = solve(CO, K, n)
y = [];
for i = 1:n
M = CO;
M(:,i) = K;
val = det(M)/det(CO);
y = [y;val];
end
end
This piece of code will work well for you. Let me know if you need mode assistance on this.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.