What am I missing in this code I am trying to find roots of a System of Equation?

1 vue (au cours des 30 derniers jours)
I am trying to find values of θ and γ for a system of equation where x(1)=θ and x(2)=γ in the code.
The equations are;
I am using the code below but I couldn't find the correct answer. The answer for
The code works, but I get different values for different x intervals, and none of them are correct. (In this case 97.90)
What am I missing?
a(1,1) is the partial differential of with respect to θ
a(1,2) is the partial differential of with respect to γ
a(2,1) is the partial differential of with respect to θ
a(2,2) is the partial differential of with respect to γ
b(1) is
b(2) is
clc;clear;
x=[-1 0.8]; err=[0.01 0.01];
niter1=10;
niter2=50;
err=transpose(abs(err));
for n=1:niter2
x
%Error Equations---------------------------
a(1,1)=-0.2*sin(x(1))+0.2*((1-0.25*sin(x(1))^2)^(-1/2))*(-0.5*sin(x(1))*cos(x(1))); a(1,2)=0;
a(2,1)=0.2*cos(x(1)); a(2,2)=-0.4*cos(x(2));
b(1)=0.2*cos(x(1))+0.4*sqrt(1-0.25*sin(x(1))*sin(x(1)))-0.32;
b(2)=0.2*sin(x(1))-0.4*sin(x(2));
%----------------------------------------------
bb=transpose(b);eps=inv(a)*bb;x=x+transpose(eps);
if n>niter1
if abs(eps)<err
break
else
disp ('Roots are not found')
end
end
end

Réponse acceptée

Walter Roberson
Walter Roberson le 26 Mai 2020
x=x+transpose(eps)
That should be subtraction rather than addition.
  1 commentaire
Ömer Faruk AKSOY
Ömer Faruk AKSOY le 26 Mai 2020
First I want to thank you for the answer it worked fine and I find the correct answer. But can I ask why it should be substruction? I have solved many problems doing addition and they worked well and I find the correct answer.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by