Power Flow Analysis Use a 3D NR approach to find a solution

Power Flow Analysis

Use a 3D NR approach to find a solution to the following non-linear equation set. Use epsilon

Solution

clc,clear
% Newton Raphson solution of two nonlinear algebraic equations
% set up the iteration
error1 = 1.e8;
xx(1) = 0; % initial guesses
xx(2) =0;
xx(3)=0;
iter=0;
maxiter=40
% begin iteration
while error1>1.e-3
iter=iter+1;
x = xx(1);
y = xx(2);
z=xx(3);
% calculate the functions
f(1) = 9*x^2+36*y^2+4*z^2-36;
f(2) = x^2-2*y^2-20*z;
f(3) =x^2-y^2+z^2;
% calculate the Jacobian
J(1,1) = 18*x;
J(1,2) = 72*y;
J(1,3) = 8*z;
J(2,1) = 2*x;
J(2,2) = -4*y;
J(2,3) = -20;
J(3,1) = 2*x;
J(3,2) = -2*y;
J(3,3) = 2*z;
% solve the linear equations
y = -J\\f\';
% move the solution, xx(k+1) - xx(k), to xx(k+1)
xx = xx + y\';
% calculate norms
error1=sqrt(y(1)^2+y(2)^2++y(3)^2);
error(iter)=sqrt(f(1)^2+f(2)^2+f(3)^2);
ii(iter)=iter;
if (iter > maxiter)
error1 = 0;
s=sprintf(\'****Did not converge within %3.0f iterations.****\',maxiter);
disp(s)
end
% check if error1 < 1.e-12
end
x = xx(1);
y = xx(2);
z = xx(3);
f(1) = 9*x^2+36*y^2+4*z^2-36;
f(2) = x^2-2*y^2-20*z;
f(3) =x^2-y^2+z^2;
% print results
f
xx
iter
% plot results
semilogy(ii,error)
xlabel(\'iteration number\')
ylabel(\'norm of functions\')
clear ii
clear error

Power Flow Analysis Use a 3D NR approach to find a solution to the following non-linear equation set. Use epsilon Solutionclc,clear % Newton Raphson solution of
Power Flow Analysis Use a 3D NR approach to find a solution to the following non-linear equation set. Use epsilon Solutionclc,clear % Newton Raphson solution of

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site