Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A pseudocode to solve the matrix equation ax = b is given below. Here, a is an n times n matrix and b is

A pseudocode to solve the matrix equation ax = b is given below. Here, a is an n \times n matrix and b is an n \times 1 vector. Write a Matlab script (you must name it GaussEl.m) that uses this pseudocode to find the vector x.
Note: Your function will be tested for
30.10.2 a =0.170.3,
0.30.210
7.85
b =19.3.(5)
71.4
Make sure that one gets the correct results when they execute the command
x = GaussEl([3,-0.1,-0.2;0.1,7,-0.3;0.3,-0.2,10],[7.85,-19.3,71.4]). You do not need to discuss results or the code on your report; make sure enough comments are available in your script.
FUNCTION [x]= GaussEl(a,b)
n = number of entries in vector b
DOFOR k =1, n-1
DOFOR i = k+1, n factor_= ai,k/ak,k DOFOR j = k+1, n
ai,j = ai,j - factor_ ak,j END DO
bi = bi factor_ bk END DO
END DO
xn = bn/an,n
DOFOR i = n-1,1,-1
sum_= bi
DOFOR j = i+1,n
sum_= sum_- ai,j xj END DO
xi = sum_/ai,i END DO
END GaussEl

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions