Effacer les filtres
Effacer les filtres

solving Z + 2 simultaneous nonlinear equations numerically (Newton) with sum

1 vue (au cours des 30 derniers jours)
khaled elbatawy
khaled elbatawy le 7 Nov 2020
Hello ,
I am trying to solve Z + 2 simultaneous nonlinear System but i have problems with that because of the sum . I do not know how to deal with that in Matlab
I have 3 Equations with 3 Unknowns the equations as follows
The Unknowns are
, and
Thank you very much for any Help

Réponses (1)

Amanpreetsingh Arora
Amanpreetsingh Arora le 10 Nov 2020
You can solve the system of equations using "fsolve". Implement a function that takes the Z+2 dimensional unknowns as input and returns Z+2 dimensional vector with the values of LHS of the Z+2 equations. Then pass this function with an initial guess to "fsolve". The documentation for "fsolve" is as follows.
  3 commentaires
Amanpreetsingh Arora
Amanpreetsingh Arora le 11 Nov 2020
How many equations and variables do you have? Your original post mentions Z+2 but the function only has 3 equations and 3 unknowns.
As per your original post, your function input "x" needs to be Z+2 dimensional. For example, you can represent your unknowns as follows.
x(1) =
x(2) =
x(3:end) = vector
which can be mapped to
F(1:Z) = The first equation (which is collection of Z equations)
F(Z+1) = 2nd eqn, F(Z+2) = 3rd eqn.
For summation, just keep adding values to F(Z+1) and F(Z+2) in the loop, as follows.
% Inside the loop
F(Z+1)=F(Z+1) + <summation term>;
F(Z+2)=F(Z+2) + <summation term>;
You don't need symsum for this.
khaled elbatawy
khaled elbatawy le 6 Déc 2020
Modifié(e) : khaled elbatawy le 6 Déc 2020
Thank you for your explaination , And sorry for the Late answer which was because of strong reasons .
My Z in my Case is 14 and every one of the 14 has , and , and from the first equation shows that and are dependent on the angle
that is mean
x(1)=
x(2)= and so on till Z=14
i have not understood well what do you mean with this F(1:Z) = The first equation (which is collection of Z equations)
F(Z+1) = 2nd eqn, F(Z+2) = 3rd eqn. ?
here is it the code that i have created , if you can see and suggest me if it is wrong or better
for g=1:Z
Vartheta(g)=(2*pi/Z)*(g-1);
end
xo=[0.0001,0.0001,40*pi/180];
[x,fval] = fsolve(@(x)root3d(x,F_R_A(v),F_A_A(v),Varth,Vartheta,h,Result,K,E,t,ChRing),xo);
Result(h, :) = abs(x);
function [F] = root3d(x,F_R,F_A,Varth)
alpha_o=40*pi/180;n=3/2;Z=14;
Cd = Geo.Dw^(1/2)/(Cdi + Cdo)^(3/2);
F(1)=x(1)-x(2)*tan(x(3))*cos(Varth(1))-A*sin(x(3)-alpha_o)/cos(x(3));
F(2)=x(4)-x(5)*tan(x(6))*cos(Varth(2))-A*sin(x(6)-alpha_o)/cos(x(6));
F(3)=x(7)-x(8)*tan(x(9))*cos(Varth(3))-A*sin(x(9)-alpha_o)/cos(x(9));
F(4)=x(10)-x(11)*tan(x(12))*cos(Varth(4))-A*sin(x(12)-alpha_o)/cos(x(12));
F(5)=x(13)-x(14)*tan(x(15))*cos(Varth(5))-A*sin(x(15)-alpha_o)/cos(x(15));
F(6)=x(16)-x(17)*tan(x(18))*cos(Varth(6))-A*sin(x(18)-alpha_o)/cos(x(18));
F(7)=x(19)-x(20)*tan(x(21))*cos(Varth(7))-A*sin(x(21)-alpha_o)/cos(x(21));
F(8)=x(22)-x(23)*tan(x(24))*cos(Varth(8))-A*sin(x(24)-alpha_o)/cos(x(24));
F(9)=x(25)-x(26)*tan(x(27))*cos(Varth(9))-A*sin(x(27)-alpha_o)/cos(x(27));
F(10)=x(28)-x(29)*tan(x(30))*cos(Varth(10))-A*sin(x(30)-alpha_o)/cos(x(30));
F(11)=x(31)-x(32)*tan(x(33))*cos(Varth(11))-A*sin(x(33)-alpha_o)/cos(x(33));
F(12)=x(34)-x(35)*tan(x(36))*cos(Varth(12))-A*sin(x(36)-alpha_o)/cos(x(36));
F(13)=x(37)-x(38)*tan(x(39))*cos(Varth(13))-A*sin(x(39)-alpha_o)/cos(x(39));
F(14)=x(40)-x(41)*tan(x(42))*cos(Varth(14))-A*sin(x(42)-alpha_o)/cos(x(42));
F_2sum=0;
F_3sum=0;
F_1sum=0;
for m=1:Z
F_2= Cd*sin(x(m))*(A*((cos(alpha_o)/cos(x(m)))-1)+(x(m)*cos(Vartheta(m))/cos(x(m))))^n;
F_3=Cd*cos(x(m))*cos(Vartheta(m))*(A*((cos(alpha_o)/cos(x(m)))-1)+(x(m)*cos(Vartheta(m))/cos(x(m))))^n;
F_2sum=F_2sum+F_2;
F_3sum=F_3sum+F_3;
end
F(15)=F_A-real(F_2sum);
F(16)=F_R-real(F_3sum);
end
Theoritically the start Value for all , and are the same for all
thank you in advance

Connectez-vous pour commenter.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by