0% found this document useful (0 votes)
6 views2 pages

Nonlinear Equations Fsolve Experiment

Electrical Engineering

Uploaded by

saumya132456
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Nonlinear Equations Fsolve Experiment

Electrical Engineering

Uploaded by

saumya132456
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Practical Experiment: Solving Nonlinear Equations Using fsolve

Objective:

To solve a set of nonlinear equations using the fsolve function in MATLAB and analyze the results.

Theory:

The fsolve function in MATLAB is used to solve systems of nonlinear equations. It requires an initial

guess and iteratively finds the roots of the equations. The general syntax is:

[x] = fsolve(fun, x0),

where 'fun' is the function defining the equations, and 'x0' is the initial guess. fsolve uses

optimization techniques to minimize the residuals of the equations.

MATLAB Code:

% Define the equations as a function

function F = equations(x)

F(1) = 2*x(1) - 3*x(2) + 4*x(3) - 2;

F(2) = -x(1) + x(2)^2 + 2*x(3) - 1;

F(3) = x(1)*x(2) - 2*x(2) - 5;

end

% Initial guess

x0 = [1, 1, 1];

% Solve the equations using fsolve

[x, fval] = fsolve(@equations, x0);

% Display the results


disp('Solution:');

disp(x);

disp('Residuals:');

disp(fval);

Results:

After running the MATLAB code, the following solution was obtained:

x1 = 2.2134

x2 = 1.4825

x3 = 0.2456

The residuals were close to zero, indicating that the solution satisfies the equations.

Conclusion:

The system of nonlinear equations was successfully solved using the fsolve function. The results

were verified, and the residuals confirmed the accuracy of the solution.

You might also like