Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB ONLY: FOLLOW ALL DIRECTIONS ACCORDINGLY AND USE THE TEMPLATE PROVIDED. Submit your m-files and a diary showing how you tested the code. Submit the

MATLAB ONLY: FOLLOW ALL DIRECTIONS ACCORDINGLY AND USE THE TEMPLATE PROVIDED.

Submit your m-files and a diary showing how you tested the code. Submit the m-files for forward, backward, and mySolve, but not MYLU.

Write a function forward.m to solve n n lower triangular systems and a function backward.m to solve n n upper triangular systems. Then write a function mySolve.m to solve n n systems (under the assumption that elimination can be performed without row exchanges). Use MYLU.m from last weeks assignment. Test your code on Ax = b with

A =

1 -5 -4 -9 5 -3 0 4 -1 0 -8 -3 -9 -3 -2 8 -8 -6 9 5 4 7 -4 0 -3

b =

-9 -4 7 6 -2

the MYLU.m file goes as:

function [L,U] = MYLU(A) n = size(A,1); % This gets the row size of A. We can also get the column L = eye(n); % L is the nxn identity matrix initially. U = A; % U is A initially. for j = 1:1:n-1 % Span certain columns of A. for i = j+1:1:n % Span certain rows of A. L(i,j) = U(i,j)/U(j,j); U(i,j:n) = U(i,j:n) - L(i,j)*U(j,j:n); end end end 

I have forward.m file as:

function f = forward(L, a) n = length(a); f = zeros(n,1); for i = 1:n f(i) = a(i)/L(i,i); a(i+1:n) = a(i+1:n)-L(i+1:n,i)*f(i); end end

USE THIS AS A TEMPLATE FOR BACKWARD.M and MYSOLVE.M FILES!

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

Database Design And Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions