solving Z + 2 simultaneous nonlinear equations numerically (Newton) with sum
1 view (last 30 days)
Show older comments
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/406195/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/406200/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/406205/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/406210/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/406215/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/406220/image.png)
Thank you very much for any Help
0 Comments
Answers (1)
Amanpreetsingh Arora
on 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 Comments
Amanpreetsingh Arora
on 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) = ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/410375/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/410375/image.png)
x(2) = ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/410380/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/410380/image.png)
x(3:end) = vector ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/410385/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/410385/image.png)
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.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!