trying to converge a variable/value used in a equation
Afficher commentaires plus anciens
i am fairly new to matlab and i have been trying to get a variable/value to converge but it looks like i am getting an infinite loop. can someone help me speed it up, tell me what is wrong or suggest a different approach. the following code is in a loop and thetadot is the value im trying to find at that point in time
b = 10;
torque_interation = zeros(1,(size(hx,2)-1));
deltaKE = 100;
thetadot(1,1) = RPS*2*pi();
while abs(deltaKE) > 0.1
q = thetadot(1,1);
torque_interation(1,i) = (work_increment(1,i)*RPS)/q;
% work in - work out = deltaKE
deltaKE = work_increment(1,i) - torque_interation(1,i)*q;
if deltaKE > 0
q = q + b;
elseif deltaKE < 0
b = b/2;
q = q - b;
end
end
thetadot(1,i) = q;
3 commentaires
Oleg Komarov
le 30 Mai 2011
Post all the relevant details, for example what's RPS.
shaun
le 30 Mai 2011
shaun
le 30 Mai 2011
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Programming 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!