Rank: 365979 based on 0 downloads (last 30 days) and 0 file submitted
photo

Danny MA

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Comments and Ratings by Danny View all
Updated File Comments Rating
17 Oct 2012 Neumerical Methods- Newton Raphson Method This script takes the input function adn solve it with the help of newton-Raphson Author: satendra kumar

17 Oct 2012 Newton Raphson method for Transcendental equations Evaluates the root of transcendental equation using Newton Raphson Method. Author: Chandan

can this code solve this equation set (several equations) at the same time?

17 Oct 2012 Non-linear equations system solver (Newton Raphson) Solves a non-linear system with iterative Newton-Raphson. Very easy and powerfull!! Author: Felipe Mendes

Felipe, thank you all the same, i will try to solve it by myself. if i have the ansewer, i will send it to you for sharing.

15 Oct 2012 Non-linear equations system solver (Newton Raphson) Solves a non-linear system with iterative Newton-Raphson. Very easy and powerfull!! Author: Felipe Mendes

Hi Felipe,

thanks for your work. When i use your code to solve five nonlinear equations, the answers are NaN, and the message is: Warning: Matrix is singular, close to singular or badly scaled.
Results may be inaccurate. RCOND = NaN.
Could you give me some suggestions on how to solve it? thanks

15 Oct 2012 Non-linear equations system solver (Newton Raphson) Solves a non-linear system with iterative Newton-Raphson. Very easy and powerfull!! Author: Felipe Mendes

here are my code:
%%%%% 1 Reading of the parameters of the solution:

%maximum number of iterations

maxiter=1000;

%parameter to establish the convergenvce criteria

epsilon=0.0000000001;

%number of equations in the non-linear system to solve

nsys=5;

%%
%%%%% 2)Reading of the (nsys)equations
Voc=33.4;
Isc=8.12;
Vm=26.2;
Im=7.63;
Ns=54;
Np=1;

%Standard form of definition of the equations:
%
%F1 = @(x1,x2,x3) x1+x2-x3+b*a;
%
% *The equations are defined as an anonymous function;
% *They must be numbered sequentially: F1,F2,F3,... ,Fnsys;
% *The function array must be filled with all the F(nsys) functions of
% the system: F={F1,F2,F3,... F(nsys)}
% *Variables must be numbered like: x1,x2,x3,... ,xnsys;
% *Number of equations must be equal to the number of variables and
% equal to (nsys)
%
%Equation 1: (F1)

F1 = @(x) Np*x(1)-Np*x(2)*(exp(Voc/Ns/x(5))-1)-Np*Voc/Ns/x(4);

%Equation 2: (F2)

F2 = @(x) Np*x(1)-Np*x(2)*(exp(Isc*x(3)/Np/x(5))-1)-Isc*x(3)/x(4)-Isc;
F3 = @(x) Np*x(1)-Np*x(2)*(exp((Vm/Ns+Im*x(3)/Np)/x(5))-1)-Np/x(4)*(Vm/Ns+Im*x(3)/Np)-Im;
F4 = @(x) (Np*x(2)*exp((Vm+Im*Ns*x(3)/Np)/Ns/x(5))/Ns/x(5)+Np/Ns/x(4))/(1+x(3)*x(2)*exp((Vm+Im*Ns*x(3)/Np)/Ns/x(5))/x(5)+x(3)/x(4))-Im/Vm;
F5 = @(x) (Np*x(2)*exp(Isc*Ns*x(3)/Np/Ns/x(5))/Ns/x(5)+Np/Ns/x(4))/(1+x(3)*x(2)*exp(Isc*Ns*x(3)/Np/Ns/x(5))/x(5)+x(3)/x(4))-1/x(4);

%%%%% Function array

F={F1,F2,F3,F4,F5};

%%%%% Reading of the initial condition of all the (nsys) variables

%nls_aleatory_initial_values;

%The values could instead be inputed one by one like done bellow:
x(1)=8.12;
x(2)=2e-9;
x(3)=6e-7;
x(4)=8700;
x(5)=0.0275;

%%%%% Verification of the input data:

%(to be created)

%Function array has an order equivalent to nsys

%(to be created)

%%
%%%%% 3)Iterative calculations

nloop=0;
nconverg=0;

while nloop<maxiter

%%%%% Assemblage of the matrix of derivative functions

dFidxj=zeros(nsys,nsys);

for i=1:1:nsys
for j=1:1:nsys
nls_derivada;
end
end

%%
%%%%% Calculation of the vector with the values of each function

for i=1:1:nsys
j=F{i};
D(i,1)=j(x);
end

%%
%%%%% Calculation of the error

A=inv(dFidxj);
error=A*D;
dx=error';

%%
%%%%% Adding the error to the x to obtain the new iteration

x=x-dx;

%%
%%%%% Parameter to determine the end of the while loop

%%%% While loop counter

nloop=nloop+1;
nconverg=nconverg+1;
%%
%%%% Converging criteria (error < epsilon)

maxdx=max(abs(error));

if maxdx<epsilon
nloop=maxiter;
end


end
%%
%%%%% 4)Presentation and store of the result values

x
nconverg

%%% The values of the variables x(1), x(2),... x(nsys) can now be atributed
%%% to their respective destines

Contact us