Write a program that will solve a system of four equations u

Write a program that will solve a system of four equations using the backslash operator. Allow the user to input each of the four equations, each as a 1 times 5 vector. Use the following set of equations to test your program: x_1 + 2x_2 - x_4 = 9 2x_1 + 3x_2 - x_3 = 9 4x_2 + 2x_3 - 5x_4 = 26 5x_1 + 5x_2 + 2x_3 - 4 x_4 = 32

Solution

main.m

clc;
close all;
clear all;
A = [1 2 0 -1;2 3 -1 0;0 4 2 -5;5 5 2 -4]
B = [9; 9; 26; 32]
x=A\\B

Output :

A =

     1     2     0    -1
     2     3    -1     0
     0     4     2    -5
     5     5     2    -4


B =

     9
     9
    26
    32


x =

    1.0000
    3.0000
    2.0000
   -2.0000

 Write a program that will solve a system of four equations using the backslash operator. Allow the user to input each of the four equations, each as a 1 times

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site