Question

2. Occasionally we use a numeric method to solve a linear system, especially if it is a large system with many zeros in it (a

0 0
Add a comment Improve this question Transcribed image text
Answer #1

clc;
close all;
clear all;

%%%we can write given equation in Ax=b form
A=[5 1 -1;2 7 1; 1 -2 -6];%%%%%A matrix
b=[2 -11 -1]';%%b vector
x=[0 0 0]';%%initial guass
N=size(x);%%number of unknowns
sum = 0;
xold = x;
%%%main algorithm
for n_iter=1:10
for i = 1:N
for j = 1:N
if (j ~= i)
sum = sum + (A(i,j)/A(i,i)) * xold(j);
else
continue;
end
end
x(i) = -sum + b(i)/A(i,i);
sum = 0;
end
if(abs(x(i)-xold(j))<0.001)
break;
end
xold = x;
end
%%displaying x vector after 10 interations
disp('x vector');
disp(x);

古古古we can write given equation in Ax=b form b= [2-11-11;%8b vector x= [ 0 0 0];%%initial guass N=size (x) ;%%number of unkn

Add a comment
Know the answer?
Add Answer to:
2. Occasionally we use a numeric method to solve a linear system, especially if it is a large sys...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • (a) use the Gauss-Seidel method to solve the following system until the percent relative error fa...

    In matlab, what is the code for the problem. (a) use the Gauss-Seidel method to solve the following system until the percent relative error falls below s a. 5%. 10x1 + 2x2-x,-27 3x1 -6x2 + 2x3 61.5 25x321.5 b. (b) write an M-file to implement the Gauss-Seidel method using the above system as a test case (a) use the Gauss-Seidel method to solve the following system until the percent relative error falls below s a. 5%. 10x1 + 2x2-x,-27 3x1...

  • 1. [12 marks] In the following parts of this question, write a MATLAB code to solve a linear syst...

    1. [12 marks] In the following parts of this question, write a MATLAB code to solve a linear system A b (A is a square nonsingular matrix) using Jacobi and Gauss-Seidel algorithms. Do not use the built-in Matlab functions for solving linear systems (a) Write a Matlab function called Jacobi that consumes a square n x n matrix A, and an n x 1 vector b, and uses the Jacobi technique to solve the system Ax-b, starting with the zero...

  • Use the Gauss Jordan method to solve the system of equations if the system has infinitely...

    Use the Gauss Jordan method to solve the system of equations if the system has infinitely many solutions, give the solution with z arbitrary. 2x - y + 5z = -3 x + 2y - 5z = 16 10y + 4z = 36

  • helpp I'm this exam 2) Use the Gauss-Seidel method to solve the following system until the...

    helpp I'm this exam 2) Use the Gauss-Seidel method to solve the following system until the percentage relative error is below 0.5% -2x1 + 2x2 – X3 = 25 - 3x1 - 6x2 + 2x3 = -40.5 X1 + x2 + 5x3 = -25.5 a) Record the table-style values. (Iteration, X1, X2, X3, Error X1, Error X2, Error X3). х iteration error X1 x2 x3

  • use linear algebra methods to solve only please 2. Find the value(s) of a (if they...

    use linear algebra methods to solve only please 2. Find the value(s) of a (if they exist) for which the system of equations has: (a) No solution. (b) One unique solution. (c) Infinitely many solutions. x + y - z = 2 x + 2y + z = 3 2x + y - 4z = a

  • Newton's Method in MATLAB During this module, we are going to use Newton's method to compute...

    Newton's Method in MATLAB During this module, we are going to use Newton's method to compute the root(s) of the function f(x) = x° + 3x² – 2x – 4 Since we need an initial approximation ('guess') of each root to use in Newton's method, let's plot the function f(x) to see many roots there are, and approximately where they lie. Exercise 1 Use MATLAB to create a plot of the function f(x) that clearly shows the locations of its...

  • Step 4 Now use the method of elimination to solve the system of equations. 18x +...

    Step 4 Now use the method of elimination to solve the system of equations. 18x + 32y = 580 2x + 16 = 164 We can eliminate y by multiplying the second equation by -2 and adding the result to the first equation. 18x + 32y = 580 -4x - 32y = -328 14x = x = So the number of servings of Designer Whey to be used is Submit Skip (you cannot come back) Need Help? Read It Talk...

  • Use the elimination method to find a general solution for the given linear system, where differentiation...

    Use the elimination method to find a general solution for the given linear system, where differentiation is with respect to t 2x' + y' - 8x - 9y = e-t x' +y' +9x + 4y = et Eliminate y and solve the remaining differential equation for x. Choose the correct answer below. O A. X(t)= C1 e 7t + Cze - 7t + 58 e-t- et O B. X(t) = Cy cos (7t) + C2 sin (7t) OC. x()=C7 e...

  • Solve the system. Use any method you wish s xy = 2 2x² + y² =...

    Solve the system. Use any method you wish s xy = 2 2x² + y² = 6 Select the correct choice below and, if necessary, fill in the answer box to complete your choice O A. The solution(s) is/are (Type an ordered pair. Use a comma to separate answers as needed. Type an exact answer, using radicals as needed. Simplify your answer.) OB. There is no solution

  • A state space linear system is shown below. Use Matlab to solve the following problems. Requirement...

    A state space linear system is shown below. Use Matlab to solve the following problems. Requirement for project report: (1) Results; (2) Matlab code. dx1/dt=-x1(t)+u(t) dx2/dt=x1(t)-2x2(t)-x3(t)+3u(t) dx3/dt=-3x3(t) y(t)=-x1(t)+2x2(t)+x3(t)+u(t) (1) Assume the system has input u(t)=e-3t if t>t0 and zero initial state x(0)=[0;0;0]. Using the transition matrix obtained, compute the system’s output (analytical solution), and plot the output as a function of time (t within 0 to 10). (2) Using the function lsim to simulate the system’s output (analytical solution), and...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT