Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

**Create a function in MATLAB starting with: function []=solvesystem(A,b) [~,n]=size(A); format long where the inputs are an matrix A and non-zero vector b with n

**Create a function in MATLAB starting with:

function []=solvesystem(A,b)

[~,n]=size(A);

format long

where the inputs are an matrix A and non-zero vector b with n entries.

**First, check whether A is invertible. If A is not invertible, you should verify if the system Ax = b is consistent. If it is consistent, the function returns a message The system is consistent, but the solution is not unique, and the program terminates. If the system is inconsistent, the function returns a message The system is inconsistent; then, the program terminates.

**If A is invertible, display 'The system has a unique solution' and function continues with solving equation Ax = b using the three methods described above; it returns the output vectors x1, x2, x3 for each of the methods (1)-(3), respectively. The vectors have to be displayed as the columns of a matrix C, that is, we will assign C=[x1, x2, x3 ]. The matrix C has to be output with a comment. To do that, type in your code:

fprintf('The solutions obtained by different methods are the columns of ')

C=[x1, x2, x3 ]

(no semicolon at the end).

**The function solvesystem must also output the vector with (x1 x2), (x2 x3), (x3 x1). (Each entry of the vector N is the 2-norm of the vector of the difference between two solutions obtained by different methods.) The vector N gives an idea how much different are the solutions obtained by various methods. To output N type in your code:

fprintf('The norms of differences between solutions are the entries of ')

(no semicolon at the end).

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

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions

Question

The acceleration of a particle is given by ax Answered: 1 week ago

Answered: 1 week ago