Cramer's Rule Homework Help
Mostrar comentarios más antiguos
Hello,
I am having a lot of trouble with this homework because I am new to matlab. Please help!
Question:
Create a MATLAB script that will read in system of linear equations (SOLE) stored in an excel file (the format will be described in more detail below) and solve for all variables using Cramer's rule. You may assume that you will always be given the same number of equations as there are number of variables, i.e. if there are three variables (x, y, z) then there will be three equations. However, your code should be able to work for an arbitrary size system of linear equations. That means you cannot assume and hardcode the size of the SOLE in your code. Use the size function in Matlab.
I am not looking for the answer, but help and hints on how to go about doing this. This is what I have based on some of my previous knowledge and what I have seen online.
data = xlsread('sole_ex1.xlsx');
x = cramer(A,b);
if det(A) == 0; error('Matrix is invalid'); end
[z,z] = size(A); for g = 1:z;
B = A;
B (:,g) = b;
x(g) = det(B)/det(A);
end
x = x';
Thank You, Ryan Albawab
1 comentario
Rakib Seemanto
el 1 de Nov. de 2020
how to find the value of x and y by using Cramer’s rule from these equations:
𝑎𝑥+𝑏𝑦=𝑐 and 𝑑𝑥+𝑒𝑦=𝑓 ???
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!