Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implement a function in Matlab to solve linear equation having complex numbers.

ID: 2267733 • Letter: I

Question

Implement a function in Matlab to solve linear equation having complex numbers. Your function, called “SolveLinearEqu” must have 2 inputs of RHS for right hand side in a linear equation and “A” for a matrix having coefficients of linear equation. For example, your function must take two inputs such as RHS = [c1, c2]’ and A = [a11 a12;a21 a22] for the following linear equation. You must design it for arbitrary dimension of linear equation (i.e., for any number of unknown variable xi.).

a(11) * x1 + a(12) * x2 = c1

a(21) * x1 + a (22)* x2 = c2

To find out answer of x1 and x2, the built-in function of “inv” will be helpful. The output of your function must return solutions of the given linear equation. For the above example, your function must return a vector of x1 and x2.

Do this in Matlab

Explanation / Answer

Matlab Script:

function x = SolveLinearEqu(RHS,A)
x = inv(A)*RHS;%gives the solution of linear equations
end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote