Solve a linear system of equations

Assignment Help MATLAB Programming
Reference no: EM13927308

Function [x] = gaussel(A,b)

% [x] = gaussel(A,b)
%
% This subroutine will perform Gaussian elimination
% and back substitution to solve the system Ax = b.
% INPUT : A - matrix for the left hand side.
% b - vector for the right hand side
%
% OUTPUT : x - the solution vector.
N = max(size(A));
% Perform Gaussian Elimination
for j=2:N,
fori=j:N,
m = A(i,j-1)/A(j-1,j-1);
A(i,:) = A(i,:) - A(j-1,:)*m;
b(i) = b(i) - m*b(j-1);
end
end
% Perform back substitution
x = zeros(N,1);
x(N) = b(N)/A(N,N);
for j=N-1:-1:1,
x(j) = (b(j)-A(j,j+1:N)*x(j+1:N))/A(j,j);
end

% End of function

a)The above programme solves a linear system of equations using naïve Gaussian elimination.

Modify this programme so that it outputs upper and lower triangular matrices of LU factorisation. The header line of the modified function should read [x, L, U] = gaussel(A, b)

Use this function, to solve the system Ax = b, where

2032_Linear system of equations.png

b) Use the LU factorisation of A obtained above to solve the system Ax = c, where

1674_Linear system of equations1.png

You can use the ‘backslash' Matlab operator for solving the systems of equations with L and U.

Reference no: EM13927308

Questions Cloud

Write essay on constructing and administrating questionaire : Write a 750-1000 word essay on constructing and administrating a questionaire and its practical application in descriptive research. Include your opinion, backed by scholarly articles, about the strengths and weaknesses of this kind of research. I..
Idea for non-violent civil protests : Where did the leaders of the civil rights movement get the idea for non-violent civil protests? Why did they embrace this tactic?
Rule of thumb to estimate the standard deviation : Use the range rule of thumb to estimate the standard deviation. Compare the estimate to the actual standard deviation. Source: Federation of Tax Administrators.
Main components of company business model : Consider a local business whose services you frequently use. What are the main components of this company's business model?
Solve a linear system of equations : Solves a linear system of equations using naïve Gaussian elimination - You can use the ‘backslash' Matlab operator for solving the systems of equations.
What is probability that jenkins will incur operating losses : What is the probability that Jenkins will incur operating losses? What is the probability that Jenkins will operate above its breakeven point?
Why doesnt the earth overheat : Every day, tremendous amounts of the sun's energy strikes the earth. Why doesn't the earth overheat?
Codes of ethics of various it professional groups : Many professionals adhere to a code of ethics specific to their profession. Examine the Codes of Ethics of various IT Professional groups, such as the ACM, SANS, ISSP, etc. Write a 2 - 3 page paper discussing whether an IT Professional would or sh..
Names and majors of students : Print the names and majors of students who are taking one of the College Geometry courses. (Hint: You'll need to use the "like" predicate and the string matching character in your query.)

Reviews

Write a Review

MATLAB Programming Questions & Answers

  Finite difference method

Use the finite difference method to calculate the temperature at the point specified since it is easier.

  Determine the necessary shell temperature

In a shell-and-tube heat exchanger, one fluid passes through a central tube while another fluid flows through an outer shell in the opposite direction. The purpose is to heat the fluid passing through the central tube.

  Find the integral of a function at an arbitrary location

Write a Matlab function to perform numerical integration of a set of evenly spaced data points using the trapezoidal rule

  Compute the speed of single-stage planetary gear train

Write a MATLAB function [speed] = planetary (N, emesh, first, last, arm) that computes the speed of a given link in a single-stage planetary gear train.

  Calculate and plot the error in the numerical derivative

Write a program to calculate and plot the error in the numerical estimate of the derivative.

  Create the graph using matlab functions

Create the graph, which contains a piecewise function where a line exists in the first interval, a parabola in the second interval, and the sine function in the third interval.

  Develop a simulation program

Develop a simulation program

  Create a vector in matlab

Create a three dimensional diagram of function.

  Open a named pipe and to read data from the pipe

Open a named pipe and to read data from the pipe in matlab

  Write the commands that will create the matrix

Write the commands that will create the matrix.

  Lagrange interpolating polynomial of degree

Lagrange interpolating polynomial of degree

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd