Iterative solution for 6x6 system

Hello,
I'm trying to solve a system of equations. There are 6 equations 6 variables but one variable is dependant to two variables. Hence, I try to give an initial guess of '0' to a variable. Then I try to iteratively solve the system until the specified tolerance is reached. But when code ran I get only one value for the asked variable instead of recording all iterations.
(Constants and intermediate variables written above of this code):
for i=1:629 if s14dot(i)<0 f14(i)=200; else f14(i)=-100; end
for j=1:1:100
f34prime=f34;
A= [1 0 -mu -mu 0 0;
0 1 1 -1 0 0;
0 0 d-s14(i)-mu*(c/2) -(d+a-s14(i))+mu*(c/2) 1 0;
-a3*sin(theta13(i)) a3*cos(theta13(i)) 0 0 -1 0;
a2*sin(theta12(i)) -a2*cos(theta12(i)) 0 0 0 1;
0 0 0 0 1 0] ;
C=[-f14(i); 0; -(b+c/2)*f14(i); 0; 0; r34*mu*f34*sign(theta13dot(i))];
B=inv(A)*C;
f34x=B(1);
f34y=B(2);
g14prime=B(3);
g14dprime=B(4);
m34=B(5);
T=B(6);
f34=sqrt(f34x^2+f34y^2);
if f34prime==0
elseif (f34-f34prime)/f34prime<0.0001
break
end
end

Réponses (1)

Torsten
Torsten le 31 Mar 2016
My guess is that you want to insert
F34(i)=f34
before the "end" of the loop over i:
...
if f34prime==0
elseif (f34-f34prime)/f34prime<0.0001
break
end
F34(i)=f34
end
Best wishes
Torsten.

Catégories

En savoir plus sur Communications Toolbox dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by