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 : Explain Parallel programming Parallel

    Parallel programming: It is a style of programming in which statements are not essentially executed in an ordered series but in parallel. The parallel programming languages make it simpler to produce programs which are designed to be run on multi-proc

  • Q : Difference between the choice and list

    Illustrate the difference between the choice and list?

  • Q : Explain Inheritance hierarchy

    Inheritance hierarchy: The relationship among super-classes and sub-classes is termed as an inheritance hierarchy. The single inheritance of classes means that each and every class has simply a single `parent' class and that Object class is the eventu

  • Q : C-C++ interfaces into WLS JMS Normal 0

    Normal 0 false false

  • Q : Define the term server-side XPointer

    Define the term server-side XPointer?

  • Q : Problem on Gaussian Matlab function

    Solve the system Ax = b, with using the given Matlab function gauss (it cal

  • Q : Advantages of Object oriented

    Q. What are the advantages of Object Oriented Programming languages? Explain them. Ans. : Object oriented programming language has following advantages-

    Q : State the term XPath State the term

    State the term XPath?

  • Q : Define Number of Threads Number of

    Number of Threads: Threads can be a useful abstraction and implementation mechanism to partition independent program actions. However, when there is coordination (or interference) between these threads, the required synchronization mechanisms increase

  • Q : What is an Attribute Attribute : It is

    Attribute: It is a particular usage of an instance variable. The set of attribute values held in a specific instance of a class state the current state of that instance. A class definition might impose specific constraints on the valid states of its i

©TutorsGlobe All rights reserved 2022-2023.