Question

In: Computer Science

Solve using matlab code!! Use the graphical method to solve 4x1 − 8x2 = −24 x1...

Solve using matlab code!!

Use the graphical method to solve

4x1 − 8x2 = −24

x1 + 6x2 = 34

Check your results by substituting them back into the equations.(include this on the code)

Solutions

Expert Solution

%4x1 − 8x2 = −24    % These are the two given equations
%x1 + 6x2 = 34

x1_line1=0:0.1:10;  % Generating points for axis x1 for line 1
x1_line2=0:0.1:10;  % Generating points for axis x1 for line 2
x2_line1 = (1/4) .* (-24 + 8.*x1_line1); % Generating corresponding points of axis x2 for all points in axis x1 of line 1
x2_line2 = 34 - (6.*x1_line2);  % Generating corresponding points of axis x2 for all points in axis x1 of line 2

plot(x2_line1, x1_line1,'r')    % plotting first line in red and second line in blue colour
hold on
plot(x2_line2, x1_line2,'b');

grid minor   % using minor so that we can know the exact intersection point
xlabel('x1')
ylabel('x2')

The above is the code to visualize the two lines. The output of the above code is shown below.

From this, we can clearly see that both lines are intersecting at (4,5).

So, test whether the point (4,5) is the solution. We should check whether that point satisfies both the lines which is done by below code. The output of the below code prints both the statements implying that the point (4,5) is indeed a solution to the given two linear equations

% 4x1−8x2+24 = 0    % These are the two given equations re arranged all terms to ne side
% x1+6x2-34 = 0
res1 = 4*(4)-8*(5)+24;
res2 = (4)+6*(5)-34;
if res1 == 0
    disp("Line 1 is satisfied with the point (4,5)")
end
if res2 == 0
    disp("Line 2 is satisfied with the point (4,5)")
end

Related Solutions

By using Big-m method Minimize z=4x1+8x2+3X3subject to x1+x2>=2, 2x1+x3>=5 and x1,x2,x3>=0
By using Big-m method Minimize z=4x1+8x2+3X3subject to x1+x2>=2, 2x1+x3>=5 and x1,x2,x3>=0
Solve the following LP problem using graphical solution method. MAX: 5 X1 + 3 X2 Subject...
Solve the following LP problem using graphical solution method. MAX: 5 X1 + 3 X2 Subject to: 2 X1 − 1 X2 ≤ 2 6 X1 + 6 X2 ≥ 12 1 X1 + 3 X2 ≤ 5 X1, X2 ≥ 0
Solve Kepler's Equations Using Euler's Method in matlab.
Solve Kepler's Equations Using Euler's Method in matlab.
Write a MATLAB code for the conjugate gradient method and apply it to solve the system...
Write a MATLAB code for the conjugate gradient method and apply it to solve the system Hx = b, where H is the n×n Hilbert matrix, and b is A times the vector of all ones, for (a) n = 4; (b) n = 8. Compare your numerical solutions with the exact solution (which is the vector of all ones), and report your numerical errors.
solve in MATLAB and screenshot code ?′′ −??′ +??= ???(????−?????)
solve in MATLAB and screenshot code ?′′ −??′ +??= ???(????−?????)
Find the dual of the following LP, using direct method. minz=4X1 +2X2 -X3 subject to X1...
Find the dual of the following LP, using direct method. minz=4X1 +2X2 -X3 subject to X1 +2X2 ≤6 X1 -X2 +2X3 =8 X1 ≥0,X2 ≥0,X3 urs
Solve by Excel Solver using  branch and bound method. Minimise: f = 4x1 + 5x2 + x3...
Solve by Excel Solver using  branch and bound method. Minimise: f = 4x1 + 5x2 + x3 + 4x4 + 2x5 + 11x6 + 2x7 Subject to: g1 = 2x1 + 4x2 + 5x3 + 7x4 + x5 + 4x6 + 10x7 ≥ 110 g2 = 4x1 + x2 + 5x3 + 7x4 + 3x7 ≤ 80 g3 = 2x1 + 5x2 + 3x3 + 3x4 + x5 + 8x6 + x7 ≥ 40 x1, x2, x3, x4 ∈ {1, 2,...
Solve the following linear programs graphically. Minimize            Z = 4X1 - X2 Subject to            X1 +...
Solve the following linear programs graphically. Minimize            Z = 4X1 - X2 Subject to            X1 + X2 ≤ 6                             X1 - X2 ≥ 3                            -X1 + 2X2 ≥ 2                            X1, X2 ≥ 0
Using Matlab 1. Solve the following equations set f1 (x1,x2) = sin (sin (x1)) +x2 f2...
Using Matlab 1. Solve the following equations set f1 (x1,x2) = sin (sin (x1)) +x2 f2 (x1,x2) = x1+ e^(x2) a) Can this equation set be solved by the fixed - point method with the following expressions? And why? Show your analysis with a 2D graph. g1 (x1,x2) = -e^(x2) g2 (x1,x2) = -sin⁡(x1) b) Use Newton Raphson Method with initial values x1 = -2, x2 = 1.5. (8 significant figures. Please submit the code and results.)
Solve the LP problem using graphical method. Determine the optimal values of the decision variables and...
Solve the LP problem using graphical method. Determine the optimal values of the decision variables and compute the objective function. Maximize Z = 2A + 10B Subject to 10A + 4B ≥ 40    A + 6B ≥ 24                A + 2B ≤ 14    A, B  ≥ 0 with soln pls thank you!
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT