Question

In: Advanced Math

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.)

Solutions

Expert Solution


%Matlab code for solving nonliear equations using Newton method
clear all
close all
%function for fixed point iterations
g1=@(x1,x2) -exp(x2);
g2=@(x1,x2) -sin(x1);

%plotting both functions
xx1=linspace(-3,3);
yy1=linspace(0,3);
[X,Y]=meshgrid(xx1,yy1);
G1=g1(X,Y);
G2=g2(X,Y);
hold on
surf(X,Y,G1)
surf(X,Y,G2)
shading interp
xlabel('X1')
ylabel('X2')
zlabel('g')
view(3)
box on
fprintf('As the two plots never touch each other, hence fixed point is not possibel.\n')
%Newton method
syms x y
%functions for which intersection have to find
f(x,y)=sin(x)+y;
g(x,y)=x+exp(y);

%Displaying the equation
fprintf('The equations are\n')
disp(f)
disp(vpa(g,2))

%creating Jacobian matrix
f_x(x,y)=diff(f,x);
f_y(x,y)=diff(f,y);
g_x(x,y)=diff(g,x);
g_y(x,y)=diff(g,y);

%Jacobian matrix
jac1=[f_x f_y; g_x g_y];
%displaying the Jacobian Matrix
fprintf('\tThe Jacobian Matrix is \n\n')
disp(vpa(jac1,2))
x1=-2;y1=1.5;
conv=10^-10;

    %loop for Newton iterations
    err=1;k=0;
    fprintf('For initial condition x=%f and y=%f \n',x1,y1)
    cnt=0;

      
    while err>conv
        cnt=cnt+1;
        jac=[f_x(x1,y1) f_y(x1,y1);g_x(x1,y1) g_y(x1,y1)];
        ijac=inv(jac);
        uu=double([x1;y1]-ijac*[f(x1,y1);g(x1,y1)]);
        %uu=double([x1;y1]-0.5*jac*[f(x1,y1);g(x1,y1)]);
        err=norm(uu-[x1;y1]);
        x1=double(uu(1));
        y1=double(uu(2));
        fprintf('After %d iteration \n',cnt)
        fprintf('\tX=%.8f and Y=%.8f \n',x1,y1)
    end
  
    fprintf('\n\n Convergence for order =%.2e occured after %d iteration\n',conv,cnt)
    fprintf('\tThe root occured at x=%f, y=%f\n\n',x1,y1)

%%%%%%%%%%%%%%%%%%%%%%end of code %%%%%%%%%%%%%%%%%%%%%%%%%%%


Related Solutions

Show that if (1) F1 and F2 are connected sets, and (2) F1 ∩ F2 is...
Show that if (1) F1 and F2 are connected sets, and (2) F1 ∩ F2 is not empty, then  F1 ∪ F2 is connected. also Suppose that F is connected. Show that F¯ (the closure of F) is also connected.
use newton raphson method to solve the following system of nonlinear equations x1^2+x2^2=50 ; x1*x2=25 stop...
use newton raphson method to solve the following system of nonlinear equations x1^2+x2^2=50 ; x1*x2=25 stop after three iterations. initial guess : (x1,x2) = (2,1)
Using Matlab code, solve the following: (a) Consider first the undamped pendulum ? + sin ?...
Using Matlab code, solve the following: (a) Consider first the undamped pendulum ? + sin ? = 0, ?(0) = 0, ? (0) = b. Let x = ? and y = ? ; then x and y satisfy the system x = y y = ? sin x, x(0) = 0 y(0) = b. Solve this system numerically and plot, on a single graph, the resulting trajectories for the initial velocities b = 0.5, 1, 1.5, 2, 2.5. Use...
Solve Kepler's Equations Using Euler's Method in matlab.
Solve Kepler's Equations Using Euler's Method in matlab.
Question 1 Using MATLAB solve the following system of linear simultaneous equations 3x + 2y -...
Question 1 Using MATLAB solve the following system of linear simultaneous equations 3x + 2y - z = 10........... [1] -x + 3y + 2z = 5........... [2] x - y - z = -1 .................[3] s + 2t - 3u + 4v = 12........... [1] 2s + 2t - 2u + 3v = 10......... [2] t + u = -1............................ [3] s - t + u - 2v = -4................ [4]
Attach a screenshot of Multisim circuit. circuit output equations are F1 = ∑ (1,3,5,7,9,15), F2 =...
Attach a screenshot of Multisim circuit. circuit output equations are F1 = ∑ (1,3,5,7,9,15), F2 = ∑ (0,2,4,6,8,10,14), design the circuit on Multisim using 8x1 MUX and 16x1 MUX. The circuit with probes on output.
Solve the following problems using the two phase method: max 3x1 + x2 S.t. x1 −...
Solve the following problems using the two phase method: max 3x1 + x2 S.t. x1 − x2 ≤ −1 −x1 − x2 ≤ −3 2x1 + x2 ≤ 4 x1, x2 ≥ 0 Please show all steps
Consider the following constrained maximization problem. maxln(x1,x2) s.t.z-x1-x2=0 Solve for x1and x2using substation method Solve for...
Consider the following constrained maximization problem. maxln(x1,x2) s.t.z-x1-x2=0 Solve for x1and x2using substation method Solve for x1and x2using Lagrange’s method
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)
Does the input requirement set V (y) = {(x1, x2, x3) | x1 + min {x2,...
Does the input requirement set V (y) = {(x1, x2, x3) | x1 + min {x2, x3} ≥ 3y, xi ≥ 0 ∀ i = 1, 2, 3} corresponds to a regular (closed and non-empty) input requirement set? Does the technology satisfies free disposal? Is the technology convex?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT