Question

Matlab: Solve the following set of simultaneous equations. Remember, the system cannot be solved if the...

Matlab: Solve the following set of simultaneous equations. Remember, the system cannot be solved if the determinant of the coefficient matrix is zero. Use if statements to only display the results if the determinant is not zero

a) 3x1 + 2x2 + 4x3 = 5

2x1 + 5x2 + 3x3 = 17

7x1 + 2x2 + 2x3 = 11

b) x – y – z = 0

30x + 40y = 12

30x + 50z = 12

c) 4x + 2y + 2z + 4w = 0

3x + y + 4z + 7w = 1

2x + y + z + 2w = 1

3x + y + z + 3w = 4

Homework Answers

Answer #1

%%% Matlab code

clc;
close all;
clear all;
%%%(a)
disp('a')
A=[3 2 4;2 5 3;7 2 2];
b=[5 17 11];
if det(A)==0
disp('Determinant is zero hence solution is not possible')
else
x=A/b;
fprintf('Solution is \n');
  
x
end

%%%(b)
disp('b')
A=[1 -1 -1;30 40 0;30 0 50];
b=[0 12 12];

if det(A)==0
disp('Determinant is zero hence solution is not possible')
else
x=A/b;
fprintf('Solution is \n');
  
x
end

%%%(c)
disp('c')

A=[4 2 2 4;3 1 4 7;2 1 1 2;3 1 1 3];
b=[0 1 1 4];
if det(A)==0
disp('Determinant is zero hence solution is not possible')
else
x=A/b;
fprintf('Solution is \n');
  
x
end

OUTPUT:

a
Solution is

x =

0.2138
0.2943
0.2092

b
Solution is

x =

-0.0833
1.6667
2.0833

c
Determinant is zero hence solution is not possible
>>

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions