Question

Using MATLAB please.Recall the formula for backward substitution to solve the upper triangular system ain 011 0 012 022 bi b. alan ... 0 0 ann be

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

Matlab code for the problem

function x = backward_substitution(A,b)

% Function to solve the upper triangular system Ax = b

n = length(b); % size of the system

x = zeros(n,1); % initilizing the x vector

for i = n:-1:1 % for loop to compute x_i

sum = 0; % variable to store the sum i+1 to n

for j = i+1:n % fo loop to compute the sum Aij*xj

sum = sum + A(i,j)*x(j); % computing the sum

end

x(i) = (b(i)-sum)/A(i,i); % computing the ith x value

end % end of for loop

end % end of function

Screen Print of the code

X 2 backward_substitution.m + function x = backward_substitution(A,b) % Function to solve the upper triangular system Ax = b

Screen Print of the output

COMMAND WINDOW >> A = [ 2, 0, 0; 1, 1, 0; 1, 2, 3] % the A matrix given A = 2 1 1 0 1 2 3 b = [6; 7; 15] % given b vector b

Add a comment
Know the answer?
Add Answer to:
Using MATLAB please. Recall the formula for backward substitution to solve the upper triangular system ain...
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
  • Using MATLAB please. Recall the formula for forward substitution to solve the lower triangular system 011...

    Using MATLAB please. Recall the formula for forward substitution to solve the lower triangular system 011 0 021 (122 ... 0 bi b2 0 ann be : anl an2 which is b; - ;=1 j=14; 1; i = 1,...n Write a M. "LAB function forward_substitution that solves a lower triangular system. Test your code using the example A= 2 0 0 1 1 0 2 3 b= 6 7 15 1

  • (Use MATLAB) Use Gaussian elimination with backward substitution to solve the following linear sy...

    (Use MATLAB) Use Gaussian elimination with backward substitution to solve the following linear system. For this problem you will have to do scaled partial pivoting. The matrix A and the vector b are in the Matlab code shown below A=[3 -13 9 3;-6 4 1 -18;6 -2 2 4;12 -8 6 10]; display(A); b=[-19;-34;16;26]; display(b);

  • Develop a function QR deceomposition using MATLAB and solve this system Develop a function qr solve that solves an n ×...

    Develop a function QR deceomposition using MATLAB and solve this system Develop a function qr solve that solves an n × n system using the MATLAB reduced QR decomposition, if the matrix is singular, the QR decomposition will complete with no error. Make the return values [x, resid], where resid is the residual Ax -bll2. A large residual will indicate that the matrix is singular or ill-conditioned. Apply the function to solve each system -713 L 21 3-481 「11 1...

  • LU Decomposition Gauss Method EX4: Solve the same problem using the Gauss method. Example 4-6: MATLAB...

    LU Decomposition Gauss Method EX4: Solve the same problem using the Gauss method. Example 4-6: MATLAB user-defined function for solving a system of equations using LU decomposition with Crout's method. ( Y Suggestions Use the code from the Crout's method. Discard the LUdecomp Crout module and leave the rest. Modify Gauss Pivot to store all the ratios Create the lower triangular matrix Confirm that L.U = A. Solve the problem by the LU double substitution Determine the currents ij, in,...

  • HERE IS THE CODE I FIXED BUT STILL DOESN'T WORK NOTE: THE VARIABLE x = zeros(size(b))...

    HERE IS THE CODE I FIXED BUT STILL DOESN'T WORK NOTE: THE VARIABLE x = zeros(size(b)) CAN'T BE CHANGED CAUSE HAS BEEN SET BY ASSESSOR HI EXPERTS I NEED HELP TO SOLVE THIS HOMEWORK PROBLEM FOR MATLAB CODE A COUPLE OF TIMES I TRIED LAST TIME TO ASK BUT ALL OF THE ANSWERS WERE WRONG PLEASE KINDLY HELP ME FIND THE RIGHT SOLUTION, ANY HELP WILL BE VERY APPRECIATE Engineering Computations and Modelling > Week 6 Homework > Backward Substitution...

  • Please write code in MATLAB. HW12_4: Solve the system of nonlinear equations over the interval 0 st0.03 using ode45. Display the results on the same graph. Include a legend. x(0)-3, y(0)-2, z(0)-1 ax...

    Please write code in MATLAB. HW12_4: Solve the system of nonlinear equations over the interval 0 st0.03 using ode45. Display the results on the same graph. Include a legend. x(0)-3, y(0)-2, z(0)-1 ax dt dy dz HW12_4: Solve the system of nonlinear equations over the interval 0 st0.03 using ode45. Display the results on the same graph. Include a legend. x(0)-3, y(0)-2, z(0)-1 ax dt dy dz

  • help me please , By using MATLAB How can I plot the solution of linear diffrential...

    help me please , By using MATLAB How can I plot the solution of linear diffrential system ? I want the code in general case We were unable to transcribe this imageclose all clear MATLAB Code: clc A= [1 0 1; 0 0 0;00-1]; % Coefficient Matrix Xo = [5 76]'; % Initial condition V, D = eig(A); % Get the Eigen values and Eigen vectors % General Solution: X=Sum of {c_i*exp(L_i*t) *V_i % where c_i are constants, L_i are...

  • Write a matlab code to solve this problem using Matlab below Please make sure it works Thank You ...

    write a matlab code to solve this problem using Matlab below Please make sure it works Thank You please use matrices The following diagram shows part of the central section of UC Davis campus. Assume that the streets are one way, and that the average number of bikes entering and leaving this section during the 10 miutes breakes btween classes is given in the chart. Find the amount of the trafic between each of four intersection 250 120 120 70...

  • Use the attached Matlab code as a basis to solve the following ordinary differential equation usi...

    Question 1 QUESTION 2 Use the attached Matlab code as a basis to solve the following ordinary differential equation using Euler's method, with timestep of 0.1, from t-0to t-100. d)0) -0 - sin (5vt cos(у Plot y versus t from t=0 to t=100. How many local maxima are on this interval(do not include end points). Be careful to count them all! Answer should be an integer 1 w% Matlab code for the solution of Module 2 3 dt-9.1; %dt is...

  • Solve Example 6.2 on page 111 of textbook, using (1) the 4th order Runge Kutta method...

    Solve Example 6.2 on page 111 of textbook, using (1) the 4th order Runge Kutta method and (2) Simulink method, respectively. Please submit your MATLAB code m file and slx file You can use the results from the code attached below (from the textbook by ODE45 solver) as a reference Example 6.2 ode45 ex.m % This program solves a system of 3 differential equations % by using ode45 function % y1 (0)=0, y2 (0)=1.0, y3 (0)=1.0 clear; clc initial [0.0...

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