trying to converge a variable/value used in a equation
Mostrar comentarios más antiguos
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 comentarios
Oleg Komarov
el 30 de Mayo de 2011
Post all the relevant details, for example what's RPS.
shaun
el 30 de Mayo de 2011
shaun
el 30 de Mayo de 2011
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!