--%>

Problem on linear equations using Matlab

Use Matlab to solve the following system of linear equations:

2x + y + 3z = 1
2x + 6y + 8z = 3
6x + 8y + 18z = 5

Capture Matlab code and the result in a text file.

E

Expert

Verified

Calculations:

% The equations represent AX = B . where A is the 3*3 Matrix of the input

% values , X is the matrix representing the variables and B is the result

% matrix; Thus we need to find X,which = b* inverse(a) or B/A

A= [ 2 1 3; 2 6 8; 6 8 18];
B= [ 1 3 5];
X= B/A;

% result of x, y, z displayed

x= X(1)
y=X(2)
z=X(3)

% results written in a text file

csvwrite('result.txt',X);

% Content of the text file displayed

type result.txt

   Related Questions in Programming Languages

  • Q : What is Stack overflow Stack overflow :

    Stack overflow: Stack overflow takes place whenever too many items are pushed onto a stack with a finite or limited capacity.

  • Q : What is Bit manipulation operator Bit

    Bit manipulation operator: Operators, like &, | and ^, which are employed to examine and manipulate individual bits win the bytes of a data item. The shift operators, <<, >> and >>>, are too bit manipulation operators.

  • Q : Define Comment Comment : It is a piece

    Comment: It is a piece of text proposed for the human reader of a program. The compilers disregard their contents.

  • Q : Define the term Base case Define the

    Define the term Base case: It is a non-recursive route via a recursive method.

  • Q : Write a recursive implementation of

    Assignment 5 Selecting Array Elements Implement the following C++ code in assembly language, using the block-structured .IF and .WHILE directives. Assume that all variables are 32-bit signed integers: int array[] = {10,60,20,33,72,89,45,65,72,18}; int sample = 50; intArraySize = s

  • Q : Explain the CPU scheduling decisions

    Explain the CPU scheduling decisions.

  • Q : Explain Default initial value Default

    Default initial value: It is the default value of any variable not explicitly initialized whenever it is declared. The fields of numeric primitive types contain the value zero by default, Boolean variables encompass the value false, char variables enc

  • Q : What is session What is meant by the

    What is meant by the session?

  • Q : Explain Primitive Type Abstractions

    Primitive Type Abstractions: An effective way to reduce the state space of a program is to replace the primitive types with the corresponding abstractions that encapsulate all the possible operations that are performed on these types.

    Q : Define the term Blank final variable

    Blank final variable: A final variable which is not initialized as portion of its declaration. This variable should be initialized in either an instance initialization block or every of the constructors for its class before it is employed. A static bl