clc;
%1)
%Define the system of equations
%Matrix A
A = [0 6 -5; %Coefficient of x1 = 0, x2 = 6, x3 = -5
0 2 7; %Coefficient of x1 = 0, x2 = 2, x3 = 7
-4 3 -7]; %Coefficient of x1 = -4, x2 = 3, x3 = -7
%Matrix b
b = [-50; -30; 50];
%find the solution using inverse A * b
x = A\b
Output:
2)
clc;
%2)
%Define the matrices
A = [2 -6 -1;
-3 -1 7;
-8 1 -2];
b = [-38; -34; -20];
%create the augmented matrix A|B
Aug=[A b];
n=rank(A);
%initialize the nrow vector
for i=1:n
nrow(i)=i;
end
nrow=nrow';
for k=1:n-1
max=0;
index=0;
%find the maximum value in the column under the current checked
element and
%return its row position
for j=k:n
if abs(Aug(nrow(j),k))>max
max=abs(Aug(nrow(j),k));
index=j;
end
end
%perform row exchange in the nrow vector
if nrow(k)~=nrow(index)
ncopy=nrow(k);
nrow(k)=nrow(index);
nrow(index)=ncopy;
else
end
%Gaussian elimination
for i=(k+1):n
m(nrow(i),k)=Aug(nrow(i),k)/Aug(nrow(k),k);
for j=k:n+1
Aug(nrow(i),j)=Aug(nrow(i),j)-m(nrow(i),k)*Aug(nrow(k),j);
end
end
end
%backward subsitution
x(n)=0;
x=x';
x(n)=Aug(nrow(n),n+1)/Aug(nrow(n),n);
i=n-1;
while i>0
x(i)=(Aug(nrow(i),n+1)-Aug(nrow(i),i+1:n)*x(i+1:n))/(Aug(nrow(i),i));
i=i-1;
end
x_soln=x
A_aug=Aug;
Output:
3)
Could someone explain these four promblems on matlab and if you do, could you write what...
Given the equations write a Matlab Function File (code) for 10x1 + 2x2 - x3 = 27 -3x1 -5x2 +2x3 = -61.5 x1 +x2 +6x3 = -21.5 (A) Compute the determinant (B) Use Cramer's rule to solve for the x's (C) Solve by naive Gauss elimination. Show all steps of the computation.
Write a program in Matlab that solves linear systems of equations using Gauss elimination with partial pivoting. Make sure that you use variables that are explicit, and make sure to include comment lines (each subroutine should have at least a sentence stating what it does). Make sure that your program checks for valid inputs in matrix and vectors dimensionality. • Using your code, solve the systems of equations in problems 9.11, 9.12, and 9.13 9.11 9.12 9.13 2x1-6x2-X3 =-38 We...
Solve the following set of equations with LU factorization with pivoting PLEASE SHOW BY HAND NOT MATLAB: 10.10 Solve the following set of equations with LU factor- ization with pivoting: 3x, - 2x2 + x3 = -10 2x, + 6x2 - 4x3 = 44 --x1 - 2x2 + 5x3 = -26
Use the Gaussian elimination method to solve each of the following systems of linear equations. In each case, indicate whether the system is consistent or inconsistent. Give the complete solution set, and if the solution set is infinite, specify three particular solutions. 1-5x1 – 2x2 + 2x3 = 14 *(a) 3x1 + x2 – x3 = -8 2x1 + 2x2 – x3 = -3 3x1 – 3x2 – 2x3 = (b) -6x1 + 4x2 + 3x3 = -38 1-2x1 +...
Please answer this MATLAB questions when able. Thanks. 4. Laboratory Problem Description In this laboratory you are required to Find the solution of the following systems of linear equation: 1) xl + x2 + x3 3 4x1 - x2 x3-2 x1 2x2 x3-2 2) 2 -1 3 A 1 3 -2. B-2 Given the following system 4x1+3x2+7x3- 3 3x1+2x2+1x3 1 2x1+3x2+4x3- 2 Using MATLAB commands solve the following system using Gaussian elimination with partial pivoting. Find P, L, and U...
Q1 The linear system Ax = b is given by: x1−x2 + 4x3 = 7 4x1 + 2x2 –x3= 18, x1 + 3x2+ x3 = 16, has the solution x=(3, 4,2)T. Using the initial guess x (0)=(1, 1,1)T Solve the above system as is using: Gauss-Seidel method. If the error increases, what does that mean and what should you do? (see b below) Condition the system so that convergence is secured and solve using the Gauss-Siedel method. Q2: Find a system...
matlab 1. Given the system of equations 9 + x2 +x3 +x4 = 75 xi +8x2 x3x54 X1+X1 +7X3 + X4 = 43 xi+x2 +x6x434 Write a code to find the solution of linear equations using a) Gauss elimination method b) Gauss-Seidel iterative method c) Jacobi's iterative method d) Compare the number of iterations required for b) and c) to the exact solution Assume an initial guess of the solution as (X1, X2, X3, X4) = (0,0,0,0).
USING MATLAB/SCILAB: Given the following set of linear equations, solve using LU DECOMPOSITION x1 + 2x2 - x3 + x4 = 5 -x1 - 2x2 - 3x3 + 2x4 = 7 2x1 + x2 - x3 - 5x4 = -1 x1 + x2 + x3 + x4 = 10 Please show me pictures of the matlab/scilab compiler or copy-paste code and output
2a. Consider the following problem. Maximize 17-Gri +80 Subject to 5x1 + 2x2 320 i 212 10 and Construct the dual problem for the above primal problem solve both the primal problem and the dual problem graphically. Identify the corner- point feasible (CPF) solutions and comer-point infeasible solutions for both problems. Calculate the objective function values for all these values. Identify the optimal solution for Z. I 피 University 2b. For each of the following linear programming models write down...
Function driver and script file please 4) The polynomial f (x)-0.0074x*-0.284x3+ 3.355x2 12.183x +5 has a real root between 15 and 20. Apply the Newton-Raphson method to this function using an initial guess of xo-16.15. Explain your results. 5) Use the roots MATLAB function to find the roots of the polynomial x x-1-0. Compare your answer to the answer you derived in in question 1. 6) Write the following set of equations below in matrix form. Use MATLAB to solve...