Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB Need help writing MatLab Program for Cramer's Rule. (REQUIREMENTS BELOW) For this lab the function will solve a 3x3 and a 4x4 examples from

MATLAB

Need help writing MatLab Program for Cramer's Rule. (REQUIREMENTS BELOW)

For this lab the function will solve a 3x3 and a 4x4 examples from the Cramers Rule Theory Document. The ULTIMATE purpose is to write this embedded function so that it can work for any system of simultaneous equations. This requires a use of matrix and vectors of size n. The second purpose is to use the Matlab functions to read and write to excel files.

Read Cramers Rule.docx to understand the concept. Run the Excel_Arrays.m file using the Excel and Matlab.xlsx file. This program shows how to read and write Excel files from Matlab.

Requirements:

1. Write a main Function that loops.

2. Have the user choose to solve a 3 by 3 or a 4 by 4 systems of equations.

3. Then the program should read the data from the appropriate sheet in the given Excel File 3Eq-4Eq.xlsx. The file has a Matrix for the Coefficients and a Vector for the Constants. These items are then passed to an embedded function to solve by Cramers Rule. See the Program Excel_Arrays.m and the Excel and Matlab.xlsx files to learn how to read and write from Excel to Matlab.

4. Write an embedded function to solve by Cramers Rule with 3 parameters:

a. Coefficient Matrix (CO)

b. Constant Vector (K)

c. Dimension of the Coefficient Matrix (n)

5. This function outputs a Vector of n unknowns.

6. This function should be built around a for loop driven by n the number of equations/unknowns.

a. For each cycle or pass of the loop this function will create the nth variables Matrix such as Mx above from the Coefficient Matrix and Constant Vector.

b. In this process the nth answer is found by the Determinant Ratio and is placed in the answer in the nth cell of the Answer Vector.

c. Finally when the loop completes output the Answer Vector to the calling Function.

7. Then the main function wil write the Answer Vector into the correct Range of the correct sheets of the Excel File 3Eq-4Eq.xlsx.

THIS STRUCTURE IS REQUIRED SO THAT OTHER SIMULTANEOUS EQUATION SOLUTIONS CAN BE DONE EASILY. You are building a general Cramer Rule Function that can solve for n Equations and n Unknowns. THIS FUNCTION WILL BE COPIED AS IS INTO THE NEXT LAB TO SOLVE A PRACTICAL PROBLEM.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

Students also viewed these Databases questions

Question

How would you establish the value of learning this material?

Answered: 1 week ago